git-commit-vandalism/builtin
Jiang Xin f2e087395b 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>
2013-08-26 09:05:22 -07:00
..
add.c Merge branch 'mm/color-auto-default' 2013-07-22 11:23:10 -07:00
annotate.c
apply.c Git 1.8.3.4 2013-07-22 11:34:25 -07:00
archive.c
bisect--helper.c
blame.c Merge branch 'tr/line-log' 2013-06-02 16:00:44 -07:00
branch.c branch: report invalid tracking branch as gone 2013-08-26 09:05:22 -07:00
bundle.c
cat-file.c Revert "cat-file: split --batch input lines on whitespace" 2013-08-02 09:29:30 -07:00
check-attr.c
check-ignore.c Merge branch 'as/check-ignore' 2013-05-29 14:23:40 -07:00
check-mailmap.c builtin: add git-check-mailmap command 2013-07-13 10:19:37 -07:00
check-ref-format.c
checkout-index.c
checkout.c Merge branch 'nd/const-struct-cache-entry' 2013-07-22 11:24:01 -07:00
clean.c Merge branch 'jx/clean-interactive' 2013-08-01 11:52:37 -07:00
clone.c Merge branch 'jk/maint-clone-shared-no-connectivity-validation' 2013-07-18 12:48:29 -07:00
column.c
commit-tree.c commit-tree: document -S option consistently 2013-03-25 15:01:22 -07:00
commit.c Merge branch 'jk/commit-how-to-abort-cherry-pick' 2013-07-31 12:38:23 -07:00
config.c Merge branch 'hv/config-from-blob' 2013-07-22 11:24:09 -07:00
count-objects.c count-objects: add -H option to humanize sizes 2013-04-10 13:27:26 -07:00
credential.c
describe.c describe: fix --contains when a tag is given as input 2013-07-18 15:16:23 -07:00
diff-files.c
diff-index.c
diff-tree.c
diff.c cmd_diff(): make it obvious which cases are exclusive of each other 2013-05-28 09:25:01 -07:00
fast-export.c many small typofixes 2013-07-29 12:32:25 -07:00
fetch-pack.c Merge branch 'jk/pkt-line-cleanup' 2013-04-01 08:59:37 -07:00
fetch.c Merge branch 'mh/reflife' 2013-06-14 08:46:14 -07:00
fmt-merge-msg.c Merge branch 'rt/commentchar-fmt-merge-msg' into maint 2013-04-26 11:10:47 -07:00
for-each-ref.c
fsck.c fsck: don't put a void*-shaped peg in a char*-shaped hole 2013-05-28 09:25:01 -07:00
gc.c
grep.c Merge branch 'jx/clean-interactive' 2013-07-22 11:24:11 -07:00
hash-object.c
help.c Merge branch 'ph/builtin-srcs-are-in-subdir-these-days' into maint 2013-07-21 22:51:29 -07:00
index-pack.c clone: open a shortcut for connectivity check 2013-05-28 08:07:20 -07:00
init-db.c
log.c teach format-patch to place other authors into in-body "From" 2013-07-03 12:11:04 -07:00
ls-files.c Merge branch 'jx/clean-interactive' 2013-07-22 11:24:11 -07:00
ls-remote.c
ls-tree.c
mailinfo.c
mailsplit.c
merge-base.c use logical OR (||) instead of binary OR (|) in logical context 2013-06-13 14:47:07 -07:00
merge-file.c
merge-index.c Convert "struct cache_entry *" to "const ..." wherever possible 2013-07-09 09:12:48 -07:00
merge-ours.c
merge-recursive.c
merge-tree.c merge-tree: handle directory/empty conflict correctly 2013-05-06 22:17:00 -07:00
merge.c Merge branch 'nd/const-struct-cache-entry' 2013-07-22 11:24:01 -07:00
mktag.c
mktree.c
mv.c i18n: mv: mark parseopt strings for translation 2012-08-20 12:23:18 -07:00
name-rev.c describe: fix --contains when a tag is given as input 2013-07-18 15:16:23 -07:00
notes.c Merge branch 'ph/builtin-srcs-are-in-subdir-these-days' into maint 2013-07-21 22:51:29 -07:00
pack-objects.c
pack-redundant.c
pack-refs.c pack-refs: merge code from pack-refs.{c,h} into refs.{c,h} 2013-05-01 15:33:11 -07:00
patch-id.c
prune-packed.c prune-packed: avoid implying "1" is DRY_RUN in prune_packed_objects() 2013-05-28 09:20:54 -07:00
prune.c Merge branch 'nd/prune-packed-dryrun-verbose' 2013-06-06 12:17:52 -07:00
push.c many small typofixes 2013-07-29 12:32:25 -07:00
read-tree.c diff-lib, read-tree, unpack-trees: mark cache_entry array paramters const 2013-06-02 15:31:14 -07:00
receive-pack.c Merge branch 'jk/receive-pack-deadlocks-with-early-failure' into maint 2013-04-26 11:12:17 -07:00
reflog.c Merge branch 'jc/prune-all' 2013-05-29 14:23:04 -07:00
remote-ext.c
remote-fd.c
remote.c remote: check for superfluous arguments in 'git remote add' 2013-04-24 13:12:51 -07:00
replace.c fix "builtin-*" references to be "builtin/*" 2013-06-18 11:05:51 -07:00
rerere.c
reset.c pretty: --format output should honor logOutputEncoding 2013-06-26 11:40:31 -07:00
rev-list.c pretty: --format output should honor logOutputEncoding 2013-06-26 11:40:31 -07:00
rev-parse.c rev-parse: add --prefix option 2013-06-17 13:30:01 -07:00
revert.c Add the LAST_ARG_MUST_BE_NULL macro 2013-07-19 09:26:15 -07:00
rm.c Merge branch 'jc/rm-submodule-error-message' 2013-08-01 11:57:25 -07:00
send-pack.c
shortlog.c pretty: --format output should honor logOutputEncoding 2013-06-26 11:40:31 -07:00
show-branch.c Merge branch 'tr/do-not-call-submodules-subprojects' 2013-07-22 11:23:30 -07:00
show-ref.c Merge branch 'db/show-ref-head' 2013-07-22 11:23:56 -07:00
stripspace.c
symbolic-ref.c
tag.c Merge branch 'ph/tag-force-no-warn-on-creation' into maint 2013-04-03 09:24:51 -07:00
tar-tree.c
unpack-file.c
unpack-objects.c
update-index.c Convert "struct cache_entry *" to "const ..." wherever possible 2013-07-09 09:12:48 -07:00
update-ref.c
update-server-info.c i18n: update-server-info: mark parseopt strings for translation 2012-08-22 10:58:29 -07:00
upload-archive.c
var.c
verify-pack.c
verify-tag.c gpg_interface: allow to request status return 2013-02-14 09:30:04 -08:00
write-tree.c