Skip to content

Commit b9e2bc5

Browse files
Michael J Grubergitster
authored andcommitted
git-status: make porcelain more robust
git status provides a porcelain mode for porcelain writers with a supposedly stable (plumbing) interface. 7a76c28 ("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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c3808ca commit b9e2bc5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wt-status.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,12 +1661,14 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
16611661
return;
16621662
branch_name = s->branch;
16631663

1664+
#define LABEL(string) (s->no_gettext ? (string) : _(string))
1665+
16641666
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 ")));
16661668

16671669
if (!strcmp(s->branch, "HEAD")) {
16681670
color_fprintf(s->fp, color(WT_STATUS_NOBRANCH, s), "%s",
1669-
_("HEAD (no branch)"));
1671+
LABEL(N_("HEAD (no branch)")));
16701672
goto conclude;
16711673
}
16721674

@@ -1691,8 +1693,6 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
16911693
if (!upstream_is_gone && !num_ours && !num_theirs)
16921694
goto conclude;
16931695

1694-
#define LABEL(string) (s->no_gettext ? (string) : _(string))
1695-
16961696
color_fprintf(s->fp, header_color, " [");
16971697
if (upstream_is_gone) {
16981698
color_fprintf(s->fp, header_color, LABEL(N_("gone")));

0 commit comments

Comments
 (0)