From 6651c3f706cc47d8055ab43f9f7907202d10655d Mon Sep 17 00:00:00 2001 From: Roel Kluin Date: Mon, 22 Jun 2009 18:42:33 +0200 Subject: [PATCH 1/4] fread does not return negative on error size_t res cannot be less than 0. fread returns 0 on error. Reported-by: Ingo Molnar Signed-off-by: Roel Kluin Signed-off-by: Junio C Hamano --- strbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strbuf.c b/strbuf.c index a88496030b..f03d11702b 100644 --- a/strbuf.c +++ b/strbuf.c @@ -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; } From 4813926921862887c23e4160908ec7b8ad9e19dd Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 27 Jun 2009 20:47:43 +0200 Subject: [PATCH 2/4] Test git archive --remote Add a small test case for git archive --remote (and thus git-upload-archive), which so far went untested. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index abb41b07ef..5f84b18fa5 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -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 && From 0f7050469b7ae9a95ab01880ecd5cf22e6e41dd2 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sat, 27 Jun 2009 20:47:44 +0200 Subject: [PATCH 3/4] Test grep --and/--or/--not Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index f275af8240..7868af8f18 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -125,6 +125,36 @@ do done +cat >expected <actual && + test_cmp expected actual +' + +cat >expected <actual && + test_cmp expected actual +' + +cat >expected <actual && + test_cmp expected actual +' + test_expect_success 'log grep setup' ' echo a >>file && test_tick && From 1bed73c64a354248d6b342e58df257e8233bcbd2 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 27 Jun 2009 18:24:11 +0200 Subject: [PATCH 4/4] gitweb/README: fix AliasMatch in example When combining "dumb client" and human-friendly access by using the '.git' extension to switch between the two, make sure the AliasMatch covers the entire request. Without a full match, a request for http://git.example.com/project/shortlog/branch..gitsomething would result in a 404 because the server would try to access the the project 'project/shortlog/branch.' The solution is still not bulletproof, so document the possible failing case. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- gitweb/README | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gitweb/README b/gitweb/README index ccda890c0e..9056d1e090 100644 --- a/gitweb/README +++ b/gitweb/README @@ -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 Options ExecCGI AddHandler cgi-script cgi @@ -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