summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57dac0b)
raw | patch | inline | side by side (parent: 57dac0b)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Wed, 1 Apr 2009 21:42:49 +0000 (23:42 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 1 Apr 2009 22:48:30 +0000 (15:48 -0700) |
This makes sure that local branches, when followed using --track, behave
the same as remote ones (e.g. differences being reported by git status
and git checkout). This fixes 1 known failure.
The fix is done within branch_get(): The first natural candidate,
namely remote_find_tracking(), does not have all the necessary info
because in general there is no remote struct for '.', and we don't want
one because it would show up in other places as well.
branch_get(), on the other hand, has access to merge_names[] (in
addition to merge[]) and therefore can set up the followed branch
easily.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
the same as remote ones (e.g. differences being reported by git status
and git checkout). This fixes 1 known failure.
The fix is done within branch_get(): The first natural candidate,
namely remote_find_tracking(), does not have all the necessary info
because in general there is no remote struct for '.', and we don't want
one because it would show up in other places as well.
branch_get(), on the other hand, has access to merge_names[] (in
addition to merge[]) and therefore can set up the followed branch
easily.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c | patch | blob | history | |
t/t6040-tracking-info.sh | patch | blob | history |
diff --git a/remote.c b/remote.c
index e5d6b100d738c388bff91bff68b14f69dea87166..30d7fdec834cc0dcc35d335754add91f96b51ab3 100644 (file)
--- a/remote.c
+++ b/remote.c
for (i = 0; i < ret->merge_nr; i++) {
ret->merge[i] = xcalloc(1, sizeof(**ret->merge));
ret->merge[i]->src = xstrdup(ret->merge_name[i]);
- remote_find_tracking(ret->remote,
- ret->merge[i]);
+ if (remote_find_tracking(ret->remote, ret->merge[i])
+ && !strcmp(ret->remote_name, "."))
+ ret->merge[i]->dst = xstrdup(ret->merge_name[i]);
}
}
}
base = branch->merge[0]->dst;
if (!prefixcmp(base, "refs/remotes/")) {
base += strlen("refs/remotes/");
+ } else if (!prefixcmp(base, "refs/heads/")) {
+ base += strlen("refs/heads/");
}
if (!num_theirs)
strbuf_addf(sb, "Your branch is ahead of '%s' "
index 2a2b6b63d50313775226d6fe55bca846a067a263..3d6db4d386a0a009892fac490818294664d188fa 100755 (executable)
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
grep "have 1 and 1 different" actual
'
-test_expect_failure 'checkout with local tracked branch' '
+test_expect_success 'checkout with local tracked branch' '
git checkout master &&
git checkout follower >actual
grep "is ahead of" actual