Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  gitweb/README: fix AliasMatch in example
  Test grep --and/--or/--not
  Test git archive --remote
  fread does not return negative on error
  • Loading branch information
Junio C Hamano committed Jun 27, 2009
2 parents 3f721d1 + 1bed73c commit 2dc7f40
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
10 changes: 9 additions & 1 deletion gitweb/README
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ named without a .git extension (e.g. /pub/git/project instead of

DocumentRoot /var/www/gitweb

AliasMatch ^(/.*?)(\.git)(/.*)? /pub/git$1$3
AliasMatch ^(/.*?)(\.git)(/.*)?$ /pub/git$1$3
<Directory /var/www/gitweb>
Options ExecCGI
AddHandler cgi-script cgi
Expand All @@ -402,6 +402,14 @@ http://git.example.com/project

will provide human-friendly gitweb access.

This solution is not 100% bulletproof, in the sense that if some project
has a named ref (branch, tag) starting with 'git/', then paths such as

http://git.example.com/project/command/abranch..git/abranch

will fail with a 404 error.



Originally written by:
Kay Sievers <kay.sievers@vrfy.org>
Expand Down
2 changes: 1 addition & 1 deletion strbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
res = fread(sb->buf + sb->len, 1, size, f);
if (res > 0)
strbuf_setlen(sb, sb->len + res);
else if (res < 0 && oldalloc == 0)
else if (oldalloc == 0)
strbuf_release(sb);
return res;
}
Expand Down
4 changes: 4 additions & 0 deletions t/t5000-tar-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ test_expect_success 'git archive with --output' \
'git archive --output=b4.tar HEAD &&
test_cmp b.tar b4.tar'

test_expect_success 'git archive --remote' \
'git archive --remote=. HEAD >b5.tar &&
test_cmp b.tar b5.tar'

test_expect_success \
'validate file modification time' \
'mkdir extract &&
Expand Down
30 changes: 30 additions & 0 deletions t/t7002-grep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,36 @@ do

done

cat >expected <<EOF
file:foo mmap bar_mmap
EOF

test_expect_success 'grep -e A --and -e B' '
git grep -e "foo mmap" --and -e bar_mmap >actual &&
test_cmp expected actual
'

cat >expected <<EOF
file:foo_mmap bar mmap
file:foo_mmap bar mmap baz
EOF


test_expect_success 'grep ( -e A --or -e B ) --and -e B' '
git grep \( -e foo_ --or -e baz \) \
--and -e " mmap" >actual &&
test_cmp expected actual
'

cat >expected <<EOF
file:foo mmap bar
EOF

test_expect_success 'grep -e A --and --not -e B' '
git grep -e "foo mmap" --and --not -e bar_mmap >actual &&
test_cmp expected actual
'

test_expect_success 'log grep setup' '
echo a >>file &&
test_tick &&
Expand Down

0 comments on commit 2dc7f40

Please sign in to comment.