diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2013-08-26 15:02:48 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-08-26 09:05:22 -0700 |
commit | f2e087395b78d5828af400072c1b621e1a373be4 (patch) | |
tree | a9d657efa55e3c856fa4abb549b3066f5cc82f3c /usage.c | |
parent | Git 1.8.4-rc3 (diff) | |
download | tgif-f2e087395b78d5828af400072c1b621e1a373be4.tar.xz |
branch: report invalid tracking branch as gone
Command "git branch -vv" will report tracking branches, but invalid
tracking branches are also reported. This is because the function
stat_tracking_info() can not distinguish invalid tracking branch
from other cases which it would not like to report, such as
there is no upstream settings at all, or nothing is changed between
one branch and its upstream.
Junio suggested missing upstream should be reported [1] like:
$ git branch -v -v
master e67ac84 initial
* topic 3fc0f2a [topicbase: gone] topic
$ git status
# On branch topic
# Your branch is based on 'topicbase', but the upstream is gone.
# (use "git branch --unset-upstream" to fixup)
...
$ git status -b -s
## topic...topicbase [gone]
...
In order to do like that, we need to distinguish these three cases
(i.e. no tracking, with configured but no longer valid tracking, and
with tracking) in function stat_tracking_info(). So the refactored
function stat_tracking_info() has three return values: -1 (with "gone"
base), 0 (no base), and 1 (with base).
If the caller does not like to report tracking info when nothing
changed between the branch and its upstream, simply checks if
num_theirs and num_ours are both 0.
[1]: http://thread.gmane.org/gmane.comp.version-control.git/231830/focus=232288
Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'usage.c')
0 files changed, 0 insertions, 0 deletions