Skip to content

Commit 661558f

Browse files
pcloudsgitster
authored andcommitted
refs.c: mark more strings for translation
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c60d769 commit 661558f

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

refs.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ int ref_resolves_to_object(const char *refname,
188188
if (flags & REF_ISBROKEN)
189189
return 0;
190190
if (!has_sha1_file(oid->hash)) {
191-
error("%s does not point to a valid object!", refname);
191+
error(_("%s does not point to a valid object!"), refname);
192192
return 0;
193193
}
194194
return 1;
@@ -567,9 +567,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)
567567
if (!warn_ambiguous_refs)
568568
break;
569569
} else if ((flag & REF_ISSYMREF) && strcmp(fullref.buf, "HEAD")) {
570-
warning("ignoring dangling symref %s", fullref.buf);
570+
warning(_("ignoring dangling symref %s"), fullref.buf);
571571
} else if ((flag & REF_ISBROKEN) && strchr(fullref.buf, '/')) {
572-
warning("ignoring broken ref %s", fullref.buf);
572+
warning(_("ignoring broken ref %s"), fullref.buf);
573573
}
574574
}
575575
strbuf_release(&fullref);
@@ -673,7 +673,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
673673
fd = hold_lock_file_for_update_timeout(&lock, filename, 0,
674674
get_files_ref_lock_timeout_ms());
675675
if (fd < 0) {
676-
strbuf_addf(err, "could not open '%s' for writing: %s",
676+
strbuf_addf(err, _("could not open '%s' for writing: %s"),
677677
filename, strerror(errno));
678678
goto done;
679679
}
@@ -683,26 +683,26 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
683683

684684
if (read_ref(pseudoref, &actual_old_oid)) {
685685
if (!is_null_oid(old_oid)) {
686-
strbuf_addf(err, "could not read ref '%s'",
686+
strbuf_addf(err, _("could not read ref '%s'"),
687687
pseudoref);
688688
rollback_lock_file(&lock);
689689
goto done;
690690
}
691691
} else if (is_null_oid(old_oid)) {
692-
strbuf_addf(err, "ref '%s' already exists",
692+
strbuf_addf(err, _("ref '%s' already exists"),
693693
pseudoref);
694694
rollback_lock_file(&lock);
695695
goto done;
696696
} else if (oidcmp(&actual_old_oid, old_oid)) {
697-
strbuf_addf(err, "unexpected object ID when writing '%s'",
697+
strbuf_addf(err, _("unexpected object ID when writing '%s'"),
698698
pseudoref);
699699
rollback_lock_file(&lock);
700700
goto done;
701701
}
702702
}
703703

704704
if (write_in_full(fd, buf.buf, buf.len) < 0) {
705-
strbuf_addf(err, "could not write to '%s'", filename);
705+
strbuf_addf(err, _("could not write to '%s'"), filename);
706706
rollback_lock_file(&lock);
707707
goto done;
708708
}
@@ -734,9 +734,9 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
734734
return -1;
735735
}
736736
if (read_ref(pseudoref, &actual_old_oid))
737-
die("could not read ref '%s'", pseudoref);
737+
die(_("could not read ref '%s'"), pseudoref);
738738
if (oidcmp(&actual_old_oid, old_oid)) {
739-
error("unexpected object ID when deleting '%s'",
739+
error(_("unexpected object ID when deleting '%s'"),
740740
pseudoref);
741741
rollback_lock_file(&lock);
742742
return -1;
@@ -871,13 +871,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
871871
if (!is_null_oid(&cb->ooid)) {
872872
oidcpy(cb->oid, noid);
873873
if (oidcmp(&cb->ooid, noid))
874-
warning("log for ref %s has gap after %s",
874+
warning(_("log for ref %s has gap after %s"),
875875
cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
876876
}
877877
else if (cb->date == cb->at_time)
878878
oidcpy(cb->oid, noid);
879879
else if (oidcmp(noid, cb->oid))
880-
warning("log for ref %s unexpectedly ended on %s",
880+
warning(_("log for ref %s unexpectedly ended on %s"),
881881
cb->refname, show_date(cb->date, cb->tz,
882882
DATE_MODE(RFC2822)));
883883
oidcpy(&cb->ooid, ooid);
@@ -935,7 +935,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
935935
if (flags & GET_OID_QUIETLY)
936936
exit(128);
937937
else
938-
die("log for %s is empty", refname);
938+
die(_("log for %s is empty"), refname);
939939
}
940940
if (cb.found_it)
941941
return 0;
@@ -1027,7 +1027,7 @@ int ref_transaction_update(struct ref_transaction *transaction,
10271027
if ((new_oid && !is_null_oid(new_oid)) ?
10281028
check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :
10291029
!refname_is_safe(refname)) {
1030-
strbuf_addf(err, "refusing to update ref with bad name '%s'",
1030+
strbuf_addf(err, _("refusing to update ref with bad name '%s'"),
10311031
refname);
10321032
return -1;
10331033
}
@@ -1103,7 +1103,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
11031103
}
11041104
}
11051105
if (ret) {
1106-
const char *str = "update_ref failed for ref '%s': %s";
1106+
const char *str = _("update_ref failed for ref '%s': %s");
11071107

11081108
switch (onerr) {
11091109
case UPDATE_REFS_MSG_ON_ERR:
@@ -1845,7 +1845,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,
18451845

18461846
if (!cmp) {
18471847
strbuf_addf(err,
1848-
"multiple updates for ref '%s' not allowed",
1848+
_("multiple updates for ref '%s' not allowed"),
18491849
refnames->items[i].string);
18501850
return 1;
18511851
} else if (cmp > 0) {
@@ -1973,13 +1973,13 @@ int refs_verify_refname_available(struct ref_store *refs,
19731973
continue;
19741974

19751975
if (!refs_read_raw_ref(refs, dirname.buf, &oid, &referent, &type)) {
1976-
strbuf_addf(err, "'%s' exists; cannot create '%s'",
1976+
strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
19771977
dirname.buf, refname);
19781978
goto cleanup;
19791979
}
19801980

19811981
if (extras && string_list_has_string(extras, dirname.buf)) {
1982-
strbuf_addf(err, "cannot process '%s' and '%s' at the same time",
1982+
strbuf_addf(err, _("cannot process '%s' and '%s' at the same time"),
19831983
refname, dirname.buf);
19841984
goto cleanup;
19851985
}
@@ -2003,7 +2003,7 @@ int refs_verify_refname_available(struct ref_store *refs,
20032003
string_list_has_string(skip, iter->refname))
20042004
continue;
20052005

2006-
strbuf_addf(err, "'%s' exists; cannot create '%s'",
2006+
strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
20072007
iter->refname, refname);
20082008
ref_iterator_abort(iter);
20092009
goto cleanup;
@@ -2014,7 +2014,7 @@ int refs_verify_refname_available(struct ref_store *refs,
20142014

20152015
extra_refname = find_descendant_ref(dirname.buf, extras, skip);
20162016
if (extra_refname)
2017-
strbuf_addf(err, "cannot process '%s' and '%s' at the same time",
2017+
strbuf_addf(err, _("cannot process '%s' and '%s' at the same time"),
20182018
refname, extra_refname);
20192019
else
20202020
ret = 0;

t/t1400-update-ref.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history wit
390390
test_when_finished "rm -f o e" &&
391391
git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
392392
test $B = $(cat o) &&
393-
test "warning: log for ref $m has gap after $gd" = "$(cat e)"
393+
test_i18ngrep -F "warning: log for ref $m has gap after $gd" e
394394
'
395395
test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
396396
test_when_finished "rm -f o e" &&
@@ -408,7 +408,7 @@ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
408408
test_when_finished "rm -f o e" &&
409409
git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
410410
test $D = $(cat o) &&
411-
test "warning: log for ref $m unexpectedly ended on $ld" = "$(cat e)"
411+
test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e
412412
'
413413

414414
rm -f .git/$m .git/logs/$m expect
@@ -462,7 +462,7 @@ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER
462462
test_expect_success 'given old value for missing pseudoref, do not create' '
463463
test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
464464
test_path_is_missing .git/PSEUDOREF &&
465-
grep "could not read ref" err
465+
test_i18ngrep "could not read ref" err
466466
'
467467

468468
test_expect_success 'create pseudoref' '
@@ -483,7 +483,7 @@ test_expect_success 'overwrite pseudoref with correct old value' '
483483
test_expect_success 'do not overwrite pseudoref with wrong old value' '
484484
test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
485485
test $C = $(cat .git/PSEUDOREF) &&
486-
grep "unexpected object ID" err
486+
test_i18ngrep "unexpected object ID" err
487487
'
488488

489489
test_expect_success 'delete pseudoref' '
@@ -495,7 +495,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' '
495495
git update-ref PSEUDOREF $A &&
496496
test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
497497
test $A = $(cat .git/PSEUDOREF) &&
498-
grep "unexpected object ID" err
498+
test_i18ngrep "unexpected object ID" err
499499
'
500500

501501
test_expect_success 'delete pseudoref with correct old value' '
@@ -512,7 +512,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' '
512512
test_when_finished git update-ref -d PSEUDOREF &&
513513
test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
514514
test $A = $(cat .git/PSEUDOREF) &&
515-
grep "already exists" err
515+
test_i18ngrep "already exists" err
516516
'
517517

518518
# Test --stdin
@@ -650,7 +650,7 @@ test_expect_success 'stdin fails with duplicate refs' '
650650
create $a $m
651651
EOF
652652
test_must_fail git update-ref --stdin <stdin 2>err &&
653-
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
653+
test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
654654
'
655655

656656
test_expect_success 'stdin create ref works' '
@@ -1052,7 +1052,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
10521052
test_expect_success 'stdin -z fails with duplicate refs' '
10531053
printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
10541054
test_must_fail git update-ref -z --stdin <stdin 2>err &&
1055-
grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
1055+
test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err
10561056
'
10571057

10581058
test_expect_success 'stdin -z create ref works' '
@@ -1283,7 +1283,7 @@ test_expect_success 'fails with duplicate HEAD update' '
12831283
update HEAD $B
12841284
EOF
12851285
test_must_fail git update-ref --stdin <stdin 2>err &&
1286-
grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
1286+
test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err &&
12871287
echo "refs/heads/target1" >expect &&
12881288
git symbolic-ref HEAD >actual &&
12891289
test_cmp expect actual &&
@@ -1300,7 +1300,7 @@ test_expect_success 'fails with duplicate ref update via symref' '
13001300
update refs/heads/symref2 $B
13011301
EOF
13021302
test_must_fail git update-ref --stdin <stdin 2>err &&
1303-
grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
1303+
test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err &&
13041304
echo "refs/heads/target2" >expect &&
13051305
git symbolic-ref refs/heads/symref2 >actual &&
13061306
test_cmp expect actual &&

t/t1404-update-ref-errors.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_update_rejected () {
2727
fi &&
2828
printf "create $prefix/%s $C\n" $create >input &&
2929
test_must_fail git update-ref --stdin <input 2>output.err &&
30-
grep -F "$error" output.err &&
30+
test_i18ngrep -F "$error" output.err &&
3131
git for-each-ref $prefix >actual &&
3232
test_cmp unchanged actual
3333
}
@@ -103,7 +103,7 @@ df_test() {
103103
printf "%s\n" "delete $delname" "create $addname $D"
104104
fi >commands &&
105105
test_must_fail git update-ref --stdin <commands 2>output.err &&
106-
test_cmp expected-err output.err &&
106+
test_i18ncmp expected-err output.err &&
107107
printf "%s\n" "$C $delref" >expected-refs &&
108108
git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
109109
test_cmp expected-refs actual-refs

t/t3210-pack-refs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ test_expect_success 'notice d/f conflict with existing directory' '
186186

187187
test_expect_success 'existing directory reports concrete ref' '
188188
test_must_fail git branch foo 2>stderr &&
189-
grep refs/heads/foo/bar/baz stderr
189+
test_i18ngrep refs/heads/foo/bar/baz stderr
190190
'
191191

192192
test_expect_success 'notice d/f conflict with existing ref' '

t/t3310-notes-merge-manual-resolve.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,9 @@ EOF
541541
test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
542542
test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
543543
# Mention refs/notes/m, and its current and expected value in output
544-
grep -q "refs/notes/m" output &&
545-
grep -q "$(git rev-parse refs/notes/m)" output &&
546-
grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
544+
test_i18ngrep -q "refs/notes/m" output &&
545+
test_i18ngrep -q "$(git rev-parse refs/notes/m)" output &&
546+
test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output &&
547547
# Verify that other notes refs has not changed (w, x, y and z)
548548
verify_notes w &&
549549
verify_notes x &&

t/t5505-remote.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
876876
cd eight &&
877877
test_must_fail git branch nomore origin
878878
) 2>err &&
879-
grep "dangling symref" err
879+
test_i18ngrep "dangling symref" err
880880
'
881881

882882
test_expect_success 'show empty remote' '

0 commit comments

Comments
 (0)