[PATCH] Fix behavior with non-committish upstream references
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Apr 27, 2009, 16:26 UTC
- Message-ID
- <1240849603-26127-1-git-send-email-git@drmicha.warpmail.net>
- In-Reply-To
- <49F03A74.5080805@emlix.com>
stat_tracking_info() assumes that upstream references (as specified by --track or set up automatically) are commits. By calling lookup_commit() on them, create_objects() creates objects for them with type commit no matter what their real type is; this disturbs lookup_tag() later on the call sequence, leading to git status, git branch -v and git checkout erroring out.
Fix this by using lookup_commit_reference() instead so that (annotated) tags can be used as upstream references.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> --- I'm sorry I won't be able to write a test any more today. Please let me whether it's okay without a test.
remote.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c index d66e2f3..2c3e905 100644 --- a/remote.c +++ b/remote.c @@ -1399,13 +1399,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs) base = branch->merge[0]->dst; if (!resolve_ref(base, sha1, 1, NULL)) return 0; - theirs = lookup_commit(sha1); + theirs = lookup_commit_reference(sha1); if (!theirs) return 0; if (!resolve_ref(branch->refname, sha1, 1, NULL)) return 0; - ours = lookup_commit(sha1); + ours = lookup_commit_reference(sha1); if (!ours) return 0;
-- 1.6.3.rc3