|
16 | 16 | #include "trailer.h"
|
17 | 17 | #include "wt-status.h"
|
18 | 18 |
|
| 19 | +static struct ref_msg { |
| 20 | + const char *gone; |
| 21 | + const char *ahead; |
| 22 | + const char *behind; |
| 23 | + const char *ahead_behind; |
| 24 | +} msgs = { |
| 25 | + /* Untranslated plumbing messages: */ |
| 26 | + "gone", |
| 27 | + "ahead %d", |
| 28 | + "behind %d", |
| 29 | + "ahead %d, behind %d" |
| 30 | +}; |
| 31 | + |
| 32 | +void setup_ref_filter_porcelain_msg(void) |
| 33 | +{ |
| 34 | + msgs.gone = _("gone"); |
| 35 | + msgs.ahead = _("ahead %d"); |
| 36 | + msgs.behind = _("behind %d"); |
| 37 | + msgs.ahead_behind = _("ahead %d, behind %d"); |
| 38 | +} |
| 39 | + |
19 | 40 | typedef enum { FIELD_STR, FIELD_ULONG, FIELD_TIME } cmp_type;
|
20 | 41 | typedef enum { COMPARE_EQUAL, COMPARE_UNEQUAL, COMPARE_NONE } cmp_status;
|
21 | 42 |
|
@@ -1181,15 +1202,15 @@ static void fill_remote_ref_details(struct used_atom *atom, const char *refname,
|
1181 | 1202 | else if (atom->u.remote_ref.option == RR_TRACK) {
|
1182 | 1203 | if (stat_tracking_info(branch, &num_ours,
|
1183 | 1204 | &num_theirs, NULL)) {
|
1184 |
| - *s = xstrdup("gone"); |
| 1205 | + *s = xstrdup(msgs.gone); |
1185 | 1206 | } else if (!num_ours && !num_theirs)
|
1186 | 1207 | *s = "";
|
1187 | 1208 | else if (!num_ours)
|
1188 |
| - *s = xstrfmt("behind %d", num_theirs); |
| 1209 | + *s = xstrfmt(msgs.behind, num_theirs); |
1189 | 1210 | else if (!num_theirs)
|
1190 |
| - *s = xstrfmt("ahead %d", num_ours); |
| 1211 | + *s = xstrfmt(msgs.ahead, num_ours); |
1191 | 1212 | else
|
1192 |
| - *s = xstrfmt("ahead %d, behind %d", |
| 1213 | + *s = xstrfmt(msgs.ahead_behind, |
1193 | 1214 | num_ours, num_theirs);
|
1194 | 1215 | if (!atom->u.remote_ref.nobracket && *s[0]) {
|
1195 | 1216 | const char *to_free = *s;
|
|
0 commit comments