Skip to content

Commit

Permalink
branch: remove lego in i18n tracking info strings
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
pclouds authored and gitster committed May 4, 2012
1 parent 16798d0 commit 21dfc09
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions builtin/branch.c
Expand Up @@ -391,6 +391,7 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
int show_upstream_ref) int show_upstream_ref)
{ {
int ours, theirs; int ours, theirs;
char *ref = NULL;
struct branch *branch = branch_get(branch_name); struct branch *branch = branch_get(branch_name);


if (!stat_tracking_info(branch, &ours, &theirs)) { if (!stat_tracking_info(branch, &ours, &theirs)) {
Expand All @@ -401,16 +402,29 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
return; return;
} }


strbuf_addch(stat, '[');
if (show_upstream_ref) if (show_upstream_ref)
strbuf_addf(stat, "%s: ", ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
shorten_unambiguous_ref(branch->merge[0]->dst, 0)); if (!ours) {
if (!ours) if (ref)
strbuf_addf(stat, _("behind %d] "), theirs); strbuf_addf(stat, _("[%s: behind %d]"), ref, theirs);
else if (!theirs) else
strbuf_addf(stat, _("ahead %d] "), ours); strbuf_addf(stat, _("[behind %d]"), theirs);
else
strbuf_addf(stat, _("ahead %d, behind %d] "), ours, theirs); } else if (!theirs) {
if (ref)
strbuf_addf(stat, _("[%s: ahead %d]"), ref, ours);
else
strbuf_addf(stat, _("[ahead %d]"), ours);
} else {
if (ref)
strbuf_addf(stat, _("[%s: ahead %d, behind %d]"),
ref, ours, theirs);
else
strbuf_addf(stat, _("[ahead %d, behind %d]"),
ours, theirs);
}
strbuf_addch(stat, ' ');
free(ref);
} }


static int matches_merge_filter(struct commit *commit) static int matches_merge_filter(struct commit *commit)
Expand Down

0 comments on commit 21dfc09

Please sign in to comment.