git-status: make porcelain more robust
git status provides a porcelain mode for porcelain writers with a supposedly stable (plumbing) interface. 7a76c28ff2 ("status: disable translation when --porcelain is used", 2014-03-20) made sure that ahead/behind info is not translated (i.e. is stable). Make sure that the remaining two strings (initial commit, detached head) are stable, too. These changes are for the v1 porcelain interface. While we do have a perfectly stable v2 porcelain interface now, some tools (such as powerline-gitstatus) are written against v1 and profit from fixing v1 without any changes on their side. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Mar 14, 2017 at 17:02 UTC
b9e2bc560a1ea29ff833981d5bc70323c265bdb7
1 file changed
+4
-4
wt-status.c
+4
-4
@@ -1661,12 +1661,14 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
1661
return;
1662
branch_name = s->branch;
1663
1664
+#define LABEL(string) (s->no_gettext ? (string) : _(string))
1665
+
1666
if (s->is_initial)
1665
- color_fprintf(s->fp, header_color, _("Initial commit on "));
1667
+ color_fprintf(s->fp, header_color, LABEL(N_("Initial commit on ")));
1668
1669
if (!strcmp(s->branch, "HEAD")) {
1670
color_fprintf(s->fp, color(WT_STATUS_NOBRANCH, s), "%s",
1669
- _("HEAD (no branch)"));
1671
+ LABEL(N_("HEAD (no branch)")));
1672
goto conclude;
1673
}
1674
@@ -1691,8 +1693,6 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
1693
if (!upstream_is_gone && !num_ours && !num_theirs)
1694
goto conclude;
1695
1694
-#define LABEL(string) (s->no_gettext ? (string) : _(string))
1695
-
1696
color_fprintf(s->fp, header_color, " [");
1697
if (upstream_is_gone) {
1698
color_fprintf(s->fp, header_color, LABEL(N_("gone")));