Skip to content

Commit

Permalink
remote: create fetch config lines with '+'
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Apr 25, 2008
1 parent f8aae12 commit 1ce89cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions builtin-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions t/t5505-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 1ce89cc

Please sign in to comment.