Skip to content

Commit c9a88de

Browse files
committed
Merge branch 'mg/track'
* mg/track: Fix behavior with non-commit upstream references Test tracking of non-commit upstreams
2 parents 44ee247 + 57ffc5f commit c9a88de

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

remote.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,13 +1399,13 @@ int stat_tracking_info(struct branch *branch, int *num_ours, int *num_theirs)
13991399
base = branch->merge[0]->dst;
14001400
if (!resolve_ref(base, sha1, 1, NULL))
14011401
return 0;
1402-
theirs = lookup_commit(sha1);
1402+
theirs = lookup_commit_reference(sha1);
14031403
if (!theirs)
14041404
return 0;
14051405

14061406
if (!resolve_ref(branch->refname, sha1, 1, NULL))
14071407
return 0;
1408-
ours = lookup_commit(sha1);
1408+
ours = lookup_commit_reference(sha1);
14091409
if (!ours)
14101410
return 0;
14111411

t/t6040-tracking-info.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,19 @@ test_expect_success 'status' '
7474
grep "have 1 and 1 different" actual
7575
'
7676

77+
test_expect_success 'status when tracking lightweight tags' '
78+
git checkout master &&
79+
git tag light &&
80+
git branch --track lighttrack light >actual &&
81+
grep "set up to track" actual &&
82+
git checkout lighttrack
83+
'
7784

85+
test_expect_success 'status when tracking annotated tags' '
86+
git checkout master &&
87+
git tag -m heavy heavy &&
88+
git branch --track heavytrack heavy >actual &&
89+
grep "set up to track" actual &&
90+
git checkout heavytrack
91+
'
7892
test_done

0 commit comments

Comments
 (0)