Code

Merge branch 'jc/maint-fetch-regression-1.5.4'
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Mar 2008 08:49:41 +0000 (01:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Mar 2008 08:49:41 +0000 (01:49 -0700)
* jc/maint-fetch-regression-1.5.4:
  git-fetch test: test tracking fetch results, not just FETCH_HEAD
  Fix branches file configuration
  Tighten refspec processing
  Fix the wrong output of `git-show v1.3.0~155^2~4` in documentation.

1  2 
remote.c

diff --cc remote.c
index 04f7521c29d10abfa4290293e1f6319990e1c0c3,d8a4671e68b4b59611ca4826dc88586f044210d5..08af7f9de124f2e06dc8edd030212ecde9c22920
+++ b/remote.c
@@@ -261,14 -213,17 +274,17 @@@ static void read_branches_file(struct r
        frag = strchr(p, '#');
        if (frag) {
                *(frag++) = '\0';
-               branch = xmalloc(strlen(frag) + 12);
-               strcpy(branch, "refs/heads/");
-               strcat(branch, frag);
+               strbuf_addf(&branch, "refs/heads/%s", frag);
+       } else
+               strbuf_addstr(&branch, "refs/heads/master");
+       if (!slash) {
+               strbuf_addf(&branch, ":refs/heads/%s", remote->name);
        } else {
-               branch = "refs/heads/master";
+               strbuf_reset(&branch);
+               strbuf_addstr(&branch, "HEAD:");
        }
 -      add_url(remote, p);
 +      add_url_alias(remote, p);
-       add_fetch_refspec(remote, branch);
+       add_fetch_refspec(remote, strbuf_detach(&branch, 0));
        remote->fetch_tags = 1; /* always auto-follow */
  }