branch: remove lego in i18n tracking info strings
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
May 3, 2012 at 20:12 UTC
21dfc09d0aac0c1909958b09358957e9388ed238
1 file changed
+23
-9
builtin/branch.c
+23
-9
@@ -391,6 +391,7 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
391
int show_upstream_ref)
392
{
393
int ours, theirs;
394
+ char *ref = NULL;
395
struct branch *branch = branch_get(branch_name);
396
397
if (!stat_tracking_info(branch, &ours, &theirs)) {
@@ -401,16 +402,29 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
402
return;
403
}
404
404
- strbuf_addch(stat, '[');
405
if (show_upstream_ref)
406
- strbuf_addf(stat, "%s: ",
407
- shorten_unambiguous_ref(branch->merge[0]->dst, 0));
408
- if (!ours)
409
- strbuf_addf(stat, _("behind %d] "), theirs);
410
- else if (!theirs)
411
- strbuf_addf(stat, _("ahead %d] "), ours);
412
- else
413
- strbuf_addf(stat, _("ahead %d, behind %d] "), ours, theirs);
406
+ ref = shorten_unambiguous_ref(branch->merge[0]->dst, 0);
407
+ if (!ours) {
408
+ if (ref)
409
+ strbuf_addf(stat, _("[%s: behind %d]"), ref, theirs);
410
+ else
411
+ strbuf_addf(stat, _("[behind %d]"), theirs);
412
+
413
+ } else if (!theirs) {
414
+ if (ref)
415
+ strbuf_addf(stat, _("[%s: ahead %d]"), ref, ours);
416
+ else
417
+ strbuf_addf(stat, _("[ahead %d]"), ours);
418
+ } else {
419
+ if (ref)
420
+ strbuf_addf(stat, _("[%s: ahead %d, behind %d]"),
421
+ ref, ours, theirs);
422
+ else
423
+ strbuf_addf(stat, _("[ahead %d, behind %d]"),
424
+ ours, theirs);
425
+ }
426
+ strbuf_addch(stat, ' ');
427
+ free(ref);
428
}
429
430
static int matches_merge_filter(struct commit *commit)