refs.c: mark more strings for translation

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 Jul 21, 2018 at 09:49 UTC 661558f0a58fc979c9c5fc1b720e48dfe23ef833
6 files changed +37 -37
refs.c
+20 -20
@@ -188,7 +188,7 @@ int ref_resolves_to_object(const char *refname,
188 if (flags & REF_ISBROKEN)
189 return 0;
190 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);
192 return 0;
193 }
194 return 1;
@@ -567,9 +567,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)
567 if (!warn_ambiguous_refs)
568 break;
569 } 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);
571 } else if ((flag & REF_ISBROKEN) && strchr(fullref.buf, '/')) {
572 - warning("ignoring broken ref %s", fullref.buf);
572 + warning(_("ignoring broken ref %s"), fullref.buf);
573 }
574 }
575 strbuf_release(&fullref);
@@ -673,7 +673,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
673 fd = hold_lock_file_for_update_timeout(&lock, filename, 0,
674 get_files_ref_lock_timeout_ms());
675 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"),
677 filename, strerror(errno));
678 goto done;
679 }
@@ -683,18 +683,18 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
683
684 if (read_ref(pseudoref, &actual_old_oid)) {
685 if (!is_null_oid(old_oid)) {
686 - strbuf_addf(err, "could not read ref '%s'",
686 + strbuf_addf(err, _("could not read ref '%s'"),
687 pseudoref);
688 rollback_lock_file(&lock);
689 goto done;
690 }
691 } else if (is_null_oid(old_oid)) {
692 - strbuf_addf(err, "ref '%s' already exists",
692 + strbuf_addf(err, _("ref '%s' already exists"),
693 pseudoref);
694 rollback_lock_file(&lock);
695 goto done;
696 } 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'"),
698 pseudoref);
699 rollback_lock_file(&lock);
700 goto done;
@@ -702,7 +702,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,
702 }
703
704 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);
706 rollback_lock_file(&lock);
707 goto done;
708 }
@@ -734,9 +734,9 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_o
734 return -1;
735 }
736 if (read_ref(pseudoref, &actual_old_oid))
737 - die("could not read ref '%s'", pseudoref);
737 + die(_("could not read ref '%s'"), pseudoref);
738 if (oidcmp(&actual_old_oid, old_oid)) {
739 - error("unexpected object ID when deleting '%s'",
739 + error(_("unexpected object ID when deleting '%s'"),
740 pseudoref);
741 rollback_lock_file(&lock);
742 return -1;
@@ -871,13 +871,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
871 if (!is_null_oid(&cb->ooid)) {
872 oidcpy(cb->oid, noid);
873 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"),
875 cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822)));
876 }
877 else if (cb->date == cb->at_time)
878 oidcpy(cb->oid, noid);
879 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"),
881 cb->refname, show_date(cb->date, cb->tz,
882 DATE_MODE(RFC2822)));
883 oidcpy(&cb->ooid, ooid);
@@ -935,7 +935,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in
935 if (flags & GET_OID_QUIETLY)
936 exit(128);
937 else
938 - die("log for %s is empty", refname);
938 + die(_("log for %s is empty"), refname);
939 }
940 if (cb.found_it)
941 return 0;
@@ -1027,7 +1027,7 @@ int ref_transaction_update(struct ref_transaction *transaction,
1027 if ((new_oid && !is_null_oid(new_oid)) ?
1028 check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :
1029 !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'"),
1031 refname);
1032 return -1;
1033 }
@@ -1103,7 +1103,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg,
1103 }
1104 }
1105 if (ret) {
1106 - const char *str = "update_ref failed for ref '%s': %s";
1106 + const char *str = _("update_ref failed for ref '%s': %s");
1107
1108 switch (onerr) {
1109 case UPDATE_REFS_MSG_ON_ERR:
@@ -1845,7 +1845,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,
1845
1846 if (!cmp) {
1847 strbuf_addf(err,
1848 - "multiple updates for ref '%s' not allowed",
1848 + _("multiple updates for ref '%s' not allowed"),
1849 refnames->items[i].string);
1850 return 1;
1851 } else if (cmp > 0) {
@@ -1973,13 +1973,13 @@ int refs_verify_refname_available(struct ref_store *refs,
1973 continue;
1974
1975 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'"),
1977 dirname.buf, refname);
1978 goto cleanup;
1979 }
1980
1981 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"),
1983 refname, dirname.buf);
1984 goto cleanup;
1985 }
@@ -2003,7 +2003,7 @@ int refs_verify_refname_available(struct ref_store *refs,
2003 string_list_has_string(skip, iter->refname))
2004 continue;
2005
2006 - strbuf_addf(err, "'%s' exists; cannot create '%s'",
2006 + strbuf_addf(err, _("'%s' exists; cannot create '%s'"),
2007 iter->refname, refname);
2008 ref_iterator_abort(iter);
2009 goto cleanup;
@@ -2014,7 +2014,7 @@ int refs_verify_refname_available(struct ref_store *refs,
2014
2015 extra_refname = find_descendant_ref(dirname.buf, extras, skip);
2016 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"),
2018 refname, extra_refname);
2019 else
2020 ret = 0;
t/t1400-update-ref.sh
+10 -10
@@ -390,7 +390,7 @@ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history wit
390 test_when_finished "rm -f o e" &&
391 git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
392 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
394 '
395 test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' '
396 test_when_finished "rm -f o e" &&
@@ -408,7 +408,7 @@ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' '
408 test_when_finished "rm -f o e" &&
409 git rev-parse --verify "master@{2005-05-28}" >o 2>e &&
410 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
412 '
413
414 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
462 test_expect_success 'given old value for missing pseudoref, do not create' '
463 test_must_fail git update-ref PSEUDOREF $A $B 2>err &&
464 test_path_is_missing .git/PSEUDOREF &&
465 - grep "could not read ref" err
465 + test_i18ngrep "could not read ref" err
466 '
467
468 test_expect_success 'create pseudoref' '
@@ -483,7 +483,7 @@ test_expect_success 'overwrite pseudoref with correct old value' '
483 test_expect_success 'do not overwrite pseudoref with wrong old value' '
484 test_must_fail git update-ref PSEUDOREF $D $E 2>err &&
485 test $C = $(cat .git/PSEUDOREF) &&
486 - grep "unexpected object ID" err
486 + test_i18ngrep "unexpected object ID" err
487 '
488
489 test_expect_success 'delete pseudoref' '
@@ -495,7 +495,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' '
495 git update-ref PSEUDOREF $A &&
496 test_must_fail git update-ref -d PSEUDOREF $B 2>err &&
497 test $A = $(cat .git/PSEUDOREF) &&
498 - grep "unexpected object ID" err
498 + test_i18ngrep "unexpected object ID" err
499 '
500
501 test_expect_success 'delete pseudoref with correct old value' '
@@ -512,7 +512,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' '
512 test_when_finished git update-ref -d PSEUDOREF &&
513 test_must_fail git update-ref PSEUDOREF $B $Z 2>err &&
514 test $A = $(cat .git/PSEUDOREF) &&
515 - grep "already exists" err
515 + test_i18ngrep "already exists" err
516 '
517
518 # Test --stdin
@@ -650,7 +650,7 @@ test_expect_success 'stdin fails with duplicate refs' '
650 create $a $m
651 EOF
652 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
654 '
655
656 test_expect_success 'stdin create ref works' '
@@ -1052,7 +1052,7 @@ test_expect_success 'stdin -z fails option with unknown name' '
1052 test_expect_success 'stdin -z fails with duplicate refs' '
1053 printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin &&
1054 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
1056 '
1057
1058 test_expect_success 'stdin -z create ref works' '
@@ -1283,7 +1283,7 @@ test_expect_success 'fails with duplicate HEAD update' '
1283 update HEAD $B
1284 EOF
1285 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 &&
1287 echo "refs/heads/target1" >expect &&
1288 git symbolic-ref HEAD >actual &&
1289 test_cmp expect actual &&
@@ -1300,7 +1300,7 @@ test_expect_success 'fails with duplicate ref update via symref' '
1300 update refs/heads/symref2 $B
1301 EOF
1302 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 &&
1304 echo "refs/heads/target2" >expect &&
1305 git symbolic-ref refs/heads/symref2 >actual &&
1306 test_cmp expect actual &&
t/t1404-update-ref-errors.sh
+2 -2
@@ -27,7 +27,7 @@ test_update_rejected () {
27 fi &&
28 printf "create $prefix/%s $C\n" $create >input &&
29 test_must_fail git update-ref --stdin <input 2>output.err &&
30 - grep -F "$error" output.err &&
30 + test_i18ngrep -F "$error" output.err &&
31 git for-each-ref $prefix >actual &&
32 test_cmp unchanged actual
33 }
@@ -103,7 +103,7 @@ df_test() {
103 printf "%s\n" "delete $delname" "create $addname $D"
104 fi >commands &&
105 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 &&
107 printf "%s\n" "$C $delref" >expected-refs &&
108 git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs &&
109 test_cmp expected-refs actual-refs
t/t3210-pack-refs.sh
+1 -1
@@ -186,7 +186,7 @@ test_expect_success 'notice d/f conflict with existing directory' '
186
187 test_expect_success 'existing directory reports concrete ref' '
188 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
190 '
191
192 test_expect_success 'notice d/f conflict with existing ref' '
t/t3310-notes-merge-manual-resolve.sh
+3 -3
@@ -541,9 +541,9 @@ EOF
541 test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
542 test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" &&
543 # 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 &&
547 # Verify that other notes refs has not changed (w, x, y and z)
548 verify_notes w &&
549 verify_notes x &&
t/t5505-remote.sh
+1 -1
@@ -876,7 +876,7 @@ test_expect_success 'remote prune to cause a dangling symref' '
876 cd eight &&
877 test_must_fail git branch nomore origin
878 ) 2>err &&
879 - grep "dangling symref" err
879 + test_i18ngrep "dangling symref" err
880 '
881
882 test_expect_success 'show empty remote' '