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 <peff@peff.net> Acked-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Dec 3, 2012 at 01:16 UTC
491e3075a29a0475984098a85cdbbb185d5a1e33
1 file changed
+9
-6
remote.c
+9
-6
@@ -1633,8 +1633,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
1633
"Your branch is ahead of '%s' by %d commits.\n",
1634
num_ours),
1635
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"));
1639
} else if (!num_ours) {
1640
strbuf_addf(sb,
1641
Q_("Your branch is behind '%s' by %d commit, "
@@ -1643,8 +1644,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
1644
"and can be fast-forwarded.\n",
1645
num_theirs),
1646
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"));
1650
} else {
1651
strbuf_addf(sb,
1652
Q_("Your branch and '%s' have diverged,\n"
@@ -1655,8 +1657,9 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb)
1657
"respectively.\n",
1658
num_theirs),
1659
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"));
1663
}
1664
return 1;
1665
}