summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-05-11 11:29:45 -0700
committerJunio C Hamano <gitster@pobox.com>2012-05-11 11:29:45 -0700
commit65029d8224159326e723b7719d18db2f3d5ab8e3 (patch)
tree660dedf3d825bc55a300512a22515de7393d7496
parent0ef576d30888bb16158a9810aea3b7841396474d (diff)
parent21dfc09d0aac0c1909958b09358957e9388ed238 (diff)
downloadgit-65029d8224159326e723b7719d18db2f3d5ab8e3.tar.gz
Merge branch 'nd/i18n-branch-lego'
Fix yet another message construction by concatenating pieces of sentenes, which is unfriendly to i18n. By Nguyễn Thái Ngọc Duy * nd/i18n-branch-lego: branch: remove lego in i18n tracking info strings
-rw-r--r--builtin/branch.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/builtin/branch.c b/builtin/branch.c
index d51648fee4..0e060f2e4a 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -391,6 +391,7 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
int show_upstream_ref)
{
int ours, theirs;
+ char *ref = NULL;
struct branch *branch = branch_get(branch_name);
if (!stat_tracking_info(branch, &ours, &theirs)) {
@@ -401,16 +402,29 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
return;
}
- strbuf_addch(stat, '[');
if (show_upstream_ref)
- strbuf_addf(stat, "%s: ",
- shorten_unambiguous_ref(branch->merge[0]->dst, 0));
- if (!ours)
- strbuf_addf(stat, _("behind %d] "), theirs);
- else if (!theirs)
- strbuf_addf(stat, _("ahead %d] "), ours);
- else
- strbuf_addf(stat, _("ahead %d, behind %d] "), ours, theirs);
+ ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
+ if (!ours) {
+ if (ref)
+ strbuf_addf(stat, _("[%s: behind %d]"), ref, theirs);
+ else
+ strbuf_addf(stat, _("[behind %d]"), 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)