diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-03-08 23:36:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-08 23:36:24 +0300 |
commit | 4094e47fd2c49fcdbd0152d20ed4d610d72680d7 (patch) | |
tree | 6f444715c2f37cf75953f4df436b6adda1483357 /builtin | |
parent | c710d182ea6d3846f6f2dc6f1b6c7dbd35c2fce8 (diff) | |
parent | f39a757dd93488103dde76e992a75edf2d772b62 (diff) |
Merge branch 'jh/status-no-ahead-behind'
"git status" can spend a lot of cycles to compute the relation
between the current branch and its upstream, which can now be
disabled with "--no-ahead-behind" option.
* jh/status-no-ahead-behind:
status: support --no-ahead-behind in long format
status: update short status to respect --no-ahead-behind
status: add --[no-]ahead-behind to status and commit for V2 format.
stat_tracking_info: return +1 when branches not equal
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/checkout.c | 2 | ||||
-rw-r--r-- | builtin/commit.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index a52af2e507..8f4dfb1046 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -609,7 +609,7 @@ static void report_tracking(struct branch_info *new_branch_info) struct strbuf sb = STRBUF_INIT; struct branch *branch = branch_get(new_branch_info->name); - if (!format_tracking_info(branch, &sb)) + if (!format_tracking_info(branch, &sb, AHEAD_BEHIND_FULL)) return; fputs(sb.buf, stdout); strbuf_release(&sb); diff --git a/builtin/commit.c b/builtin/commit.c index e8e8d13be4..c14f95dbf6 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1061,6 +1061,9 @@ static void finalize_deferred_config(struct wt_status *s) s->show_branch = status_deferred_config.show_branch; if (s->show_branch < 0) s->show_branch = 0; + + if (s->ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED) + s->ahead_behind_flags = AHEAD_BEHIND_FULL; } static int parse_and_validate_options(int argc, const char *argv[], @@ -1277,6 +1280,8 @@ int cmd_status(int argc, const char **argv, const char *prefix) N_("show branch information")), OPT_BOOL(0, "show-stash", &s.show_stash, N_("show stash information")), + OPT_BOOL(0, "ahead-behind", &s.ahead_behind_flags, + N_("compute full ahead/behind values")), { OPTION_CALLBACK, 0, "porcelain", &status_format, N_("version"), N_("machine-readable output"), PARSE_OPT_OPTARG, opt_parse_porcelain }, @@ -1437,6 +1442,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) OPT_SET_INT(0, "short", &status_format, N_("show status concisely"), STATUS_FORMAT_SHORT), OPT_BOOL(0, "branch", &s.show_branch, N_("show branch information")), + OPT_BOOL(0, "ahead-behind", &s.ahead_behind_flags, + N_("compute full ahead/behind values")), OPT_SET_INT(0, "porcelain", &status_format, N_("machine-readable output"), STATUS_FORMAT_PORCELAIN), OPT_SET_INT(0, "long", &status_format, |