Code

Merge git://git.bogomips.org/git-svn
authorJunio C Hamano <gitster@pobox.com>
Sun, 28 Jun 2009 03:09:04 +0000 (20:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 28 Jun 2009 03:09:04 +0000 (20:09 -0700)
* git://git.bogomips.org/git-svn:
  git svn: Doc update for multiple branch and tag paths
  git svn: cleanup t9138-multiple-branches
  git-svn: Canonicalize svn urls to prevent libsvn assertion
  t9138: remove stray dot in test which broke bash
  git-svn: convert globs to regexps for branch destinations
  git svn: Support multiple branch and tag paths in the svn repository.
  Add 'git svn reset' to unwind 'git svn fetch'
  git-svn: speed up find_rev_before
  Add 'git svn help [cmd]' which works outside a repo.
  git-svn: let 'dcommit $rev' work on $rev instead of HEAD

builtin-remote.c
gitweb/README
strbuf.c
t/t5000-tar-tree.sh
t/t7002-grep.sh
t/t9001-send-email.sh

index 658d578588fed5d9f0c8a9c16808b6182c34f657..2fb76d32f86cb4e699036b40eac9bd9a747fb77f 100644 (file)
@@ -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;
index ccda890c0ef1b2d1fb1c451d3f9a10d97817c8f6..9056d1e090b314cfa617ccd8aa03047b3aea23b4 100644 (file)
@@ -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>
index a88496030b7053a543173c299bd9f54b923db2ec..f03d11702b3f6212ca7305df60f2f9ea6ca49e35 100644 (file)
--- 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;
 }
index abb41b07ef1985d53c2186617e6b2fcf7e7fe033..5f84b18fa5f0f199905bc7fc045672b70035a708 100755 (executable)
@@ -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 &&
index f275af82403dc0f1de4c584074c0eb63e61a6704..7868af8f1896e621b98a2ae9b71492a68a96e584 100755 (executable)
@@ -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 &&
index fb7d9f3e4a9e111e22299a29ca5af3a42101fbdc..fb606a9f05bd6964c588f1ba9e5422e757d12387 100755 (executable)
@@ -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>" \