summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-remote.c16
-rw-r--r--gitweb/README10
-rw-r--r--strbuf.c2
-rwxr-xr-xt/t5000-tar-tree.sh4
-rwxr-xr-xt/t7002-grep.sh30
-rwxr-xr-xt/t9001-send-email.sh5
6 files changed, 55 insertions, 12 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 658d578588..2fb76d32f8 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -1276,15 +1276,14 @@ static int update(int argc, const char **argv)
static int get_one_entry(struct remote *remote, void *priv)
{
struct string_list *list = priv;
+ struct strbuf url_buf = STRBUF_INIT;
const char **url;
int i, url_nr;
- void **utilp;
if (remote->url_nr > 0) {
- utilp = &(string_list_append(remote->name, list)->util);
- *utilp = xmalloc(strlen(remote->url[0])+strlen(" (fetch)")+1);
- strcpy((char *) *utilp, remote->url[0]);
- strcat((char *) *utilp, " (fetch)");
+ strbuf_addf(&url_buf, "%s (fetch)", remote->url[0]);
+ string_list_append(remote->name, list)->util =
+ strbuf_detach(&url_buf, NULL);
} else
string_list_append(remote->name, list)->util = NULL;
if (remote->pushurl_nr) {
@@ -1296,10 +1295,9 @@ static int get_one_entry(struct remote *remote, void *priv)
}
for (i = 0; i < url_nr; i++)
{
- utilp = &(string_list_append(remote->name, list)->util);
- *utilp = xmalloc(strlen(url[i])+strlen(" (push)")+1);
- strcpy((char *) *utilp, url[i]);
- strcat((char *) *utilp, " (push)");
+ strbuf_addf(&url_buf, "%s (push)", url[i]);
+ string_list_append(remote->name, list)->util =
+ strbuf_detach(&url_buf, NULL);
}
return 0;
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
<Directory /var/www/gitweb>
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 <kay.sievers@vrfy.org>
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;
}
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 &&
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 <<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 &&
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index fb7d9f3e4a..fb606a9f05 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -152,7 +152,10 @@ test_expect_success 'cccmd works' '
clean_fake_sendmail &&
cp $patches cccmd.patch &&
echo cccmd--cccmd@example.com >>cccmd.patch &&
- echo sed -n s/^cccmd--//p \"\$1\" > cccmd-sed &&
+ {
+ echo "#!$SHELL_PATH"
+ echo sed -n -e s/^cccmd--//p \"\$1\"
+ } > cccmd-sed &&
chmod +x cccmd-sed &&
git send-email \
--from="Example <nobody@example.com>" \