Code

remote: create fetch config lines with '+'
authorJeff King <peff@peff.net>
Tue, 22 Apr 2008 11:11:13 +0000 (07:11 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Apr 2008 05:30:31 +0000 (22:30 -0700)
Since git-remote always uses remote tracking branches, it
should be safe to always force updates of those branches.
I.e., we should generate

  fetch = +refs/heads/*:refs/remotes/$remote/*

instead of

  fetch = refs/heads/*:refs/remotes/$remote/*

This was the behavior of the perl version, which seems to
have been lost in the C rewrite.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-remote.c
t/t5505-remote.sh

index 8fe31dbd9af2833f4dc6c3e93b9179f20d2a1d66..4149f3b3ce4bed091200fdff539e459aa39fb06d 100644 (file)
@@ -105,6 +105,7 @@ static int add(int argc, const char **argv)
                struct path_list_item *item = track.items + i;
 
                strbuf_reset(&buf2);
+               strbuf_addch(&buf2, '+');
                if (mirror)
                        strbuf_addf(&buf2, "refs/%s:refs/%s",
                                        item->path, item->path);
index af2d077792c108a9125c73d1e4194f2532cb5156..48ff2d424d1587bde388422da874feb3d55cbf0d 100755 (executable)
@@ -77,6 +77,16 @@ test_expect_success 'add another remote' '
 )
 '
 
+test_expect_success 'remote forces tracking branches' '
+(
+       cd test &&
+       case `git config remote.second.fetch` in
+       +*) true ;;
+        *) false ;;
+       esac
+)
+'
+
 test_expect_success 'remove remote' '
 (
        cd test &&