File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ status.branch::
1515status.aheadBehind::
1616 EXPERIMENTAL, Set to true to enable --ahead-behind and false to
1717 enable --no-ahead-behind by default in linkgit:git-status[1] for
18- all status formats. Defaults to true. Changing this may
19- break backwards compatibility for existing scripts.
18+ non-porcelain status formats. Defaults to true.
2019
2120status.displayCommentPrefix::
2221 If set to true, linkgit:git-status[1] will insert a comment
Original file line number Diff line number Diff line change @@ -1157,11 +1157,13 @@ static void finalize_deferred_config(struct wt_status *s)
11571157
11581158 /*
11591159 * If the user did not give a "--[no]-ahead-behind" command
1160- * line argument, then we inherit the a/b config setting.
1161- * If is not set, then we inherit _FULL for backwards
1162- * compatibility.
1160+ * line argument *AND* we will print in a human-readable format
1161+ * (short, long etc.) then we inherit from the status.aheadbehind
1162+ * config setting. In all other cases (and porcelain V[12] formats
1163+ * in particular), we inherit _FULL for backwards compatibility.
11631164 */
1164- if (s -> ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED )
1165+ if (use_deferred_config &&
1166+ s -> ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED )
11651167 s -> ahead_behind_flags = status_deferred_config .ahead_behind ;
11661168
11671169 if (s -> ahead_behind_flags == AHEAD_BEHIND_UNSPECIFIED )
Original file line number Diff line number Diff line change @@ -436,10 +436,6 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
436436 git status --no-ahead-behind --porcelain=v2 --branch --untracked-files=all >actual &&
437437 test_cmp expect actual &&
438438
439- # Confirmat that "status.aheadbehind" works on V2 format.
440- git -c status.aheadbehind=false status --porcelain=v2 --branch --untracked-files=all >actual &&
441- test_cmp expect actual &&
442-
443439 # Confirm --ahead-behind reports traditional branch.ab with 1/0.
444440 cat >expect <<-EOF &&
445441 # branch.oid $HUF
@@ -449,6 +445,14 @@ test_expect_success 'verify --[no-]ahead-behind with V2 format' '
449445 EOF
450446
451447 git status --ahead-behind --porcelain=v2 --branch --untracked-files=all >actual &&
448+ test_cmp expect actual &&
449+
450+ # Confirm that "status.aheadbehind" DOES NOT work on V2 format.
451+ git -c status.aheadbehind=false status --porcelain=v2 --branch --untracked-files=all >actual &&
452+ test_cmp expect actual &&
453+
454+ # Confirm that "status.aheadbehind" DOES NOT work on V2 format.
455+ git -c status.aheadbehind=true status --porcelain=v2 --branch --untracked-files=all >actual &&
452456 test_cmp expect actual
453457 )
454458'
You can’t perform that action at this time.
0 commit comments