Skip to content

Commit 491e307

Browse files
peffgitster
authored andcommitted
status: respect advice.statusHints for ahead/behind advice
If the user has unset advice.statusHints, we already suppress the "use git reset to..." hints in each stanza. The new "use git push to publish..." hint is the same type of hint. Let's respect statusHints for it, rather than making the user set yet another advice flag. Signed-off-by: Jeff King <[email protected]> Acked-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c190ced commit 491e307

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

remote.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
16331633
"Your branch is ahead of '%s' by %d commits.\n",
16341634
num_ours),
16351635
base, num_ours);
1636-
strbuf_addf(sb,
1637-
_(" (use \"git push\" to publish your local commits)\n"));
1636+
if (advice_status_hints)
1637+
strbuf_addf(sb,
1638+
_(" (use \"git push\" to publish your local commits)\n"));
16381639
} else if (!num_ours) {
16391640
strbuf_addf(sb,
16401641
Q_("Your branch is behind '%s' by %d commit, "
@@ -1643,8 +1644,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
16431644
"and can be fast-forwarded.\n",
16441645
num_theirs),
16451646
base, num_theirs);
1646-
strbuf_addf(sb,
1647-
_(" (use \"git pull\" to update your local branch)\n"));
1647+
if (advice_status_hints)
1648+
strbuf_addf(sb,
1649+
_(" (use \"git pull\" to update your local branch)\n"));
16481650
} else {
16491651
strbuf_addf(sb,
16501652
Q_("Your branch and '%s' have diverged,\n"
@@ -1655,8 +1657,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
16551657
"respectively.\n",
16561658
num_theirs),
16571659
base, num_ours, num_theirs);
1658-
strbuf_addf(sb,
1659-
_(" (use \"git pull\" to merge the remote branch into yours)\n"));
1660+
if (advice_status_hints)
1661+
strbuf_addf(sb,
1662+
_(" (use \"git pull\" to merge the remote branch into yours)\n"));
16601663
}
16611664
return 1;
16621665
}

0 commit comments

Comments
 (0)