Merge branch 'nd/i18n'
authorJunio C Hamano <gitster@pobox.com>
Fri, 4 Jan 2019 21:33:31 +0000 (13:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 4 Jan 2019 21:33:31 +0000 (13:33 -0800)
More _("i18n") markings.

* nd/i18n:
fsck: mark strings for translation
fsck: reduce word legos to help i18n
parse-options.c: mark more strings for translation
parse-options.c: turn some die() to BUG()
parse-options: replace opterror() with optname()
repack: mark more strings for translation
remote.c: mark messages for translation
remote.c: turn some error() or die() to BUG()
reflog: mark strings for translation
read-cache.c: add missing colon separators
read-cache.c: mark more strings for translation
read-cache.c: turn die("internal error") to BUG()
attr.c: mark more string for translation
archive.c: mark more strings for translation
alias.c: mark split_cmdline_strerror() strings for translation
git.c: mark more strings for translation

19 files changed:
1  2 
archive.c
attr.c
builtin/fsck.c
builtin/merge.c
builtin/reflog.c
builtin/repack.c
git.c
parse-options-cb.c
parse-options.c
parse-options.h
read-cache.c
ref-filter.c
remote.c
t/t0040-parse-options.sh
t/t1410-reflog.sh
t/t1450-fsck.sh
t/t5616-partial-clone.sh
t/t5703-upload-pack-ref-in-want.sh
t/t6050-replace.sh
diff --cc archive.c
Simple merge
diff --cc attr.c
Simple merge
diff --cc builtin/fsck.c
index 3c3e0f06e78009ee3ee2d54333dfc4740b8792a9,dcf72859a6e24004c06c37492e3a3e764d6c2334..a281d7cd123b830bf89c2e21ccbcb10f55f40ab9
@@@ -610,29 -607,28 +633,30 @@@ static int fsck_head_link(const char *h
        int null_is_error = 0;
  
        if (verbose)
-               fprintf(stderr, "Checking %s link\n", head_ref_name);
 -              fprintf_ln(stderr, _("Checking HEAD link"));
++              fprintf_ln(stderr, _("Checking %s link"), head_ref_name);
  
 -      head_points_at = resolve_ref_unsafe("HEAD", 0, &head_oid, NULL);
 -      if (!head_points_at) {
 +      *head_points_at = resolve_ref_unsafe(head_ref_name, 0, head_oid, NULL);
 +      if (!*head_points_at) {
                errors_found |= ERROR_REFS;
-               return error("Invalid %s", head_ref_name);
 -              return error(_("invalid HEAD"));
++              return error(_("invalid %s"), head_ref_name);
        }
 -      if (!strcmp(head_points_at, "HEAD"))
 +      if (!strcmp(*head_points_at, head_ref_name))
                /* detached HEAD */
                null_is_error = 1;
 -      else if (!starts_with(head_points_at, "refs/heads/")) {
 +      else if (!starts_with(*head_points_at, "refs/heads/")) {
                errors_found |= ERROR_REFS;
-               return error("%s points to something strange (%s)",
 -              return error(_("HEAD points to something strange (%s)"),
 -                           head_points_at);
++              return error(_("%s points to something strange (%s)"),
 +                           head_ref_name, *head_points_at);
        }
 -      if (is_null_oid(&head_oid)) {
 +      if (is_null_oid(head_oid)) {
                if (null_is_error) {
                        errors_found |= ERROR_REFS;
-                       return error("%s: detached HEAD points at nothing",
 -                      return error(_("HEAD: detached HEAD points at nothing"));
++                      return error(_("%s: detached HEAD points at nothing"),
 +                                   head_ref_name);
                }
-               fprintf(stderr, "notice: %s points to an unborn branch (%s)\n",
-                       head_ref_name, *head_points_at + 11);
 -              fprintf_ln(stderr, _("notice: HEAD points to an unborn branch (%s)"),
 -                         head_points_at + 11);
++              fprintf_ln(stderr,
++                         _("notice: %s points to an unborn branch (%s)"),
++                         head_ref_name, *head_points_at + 11);
        }
        return 0;
  }
diff --cc builtin/merge.c
Simple merge
Simple merge
index 45583683eef4d59d1c8b957a8d9a8c0834db0e48,721f947218dc1374766e5e3c2e89b41d18de9c90..2a1c7b21c5d9cb52c328105b470366d1c7ef7c76
@@@ -235,8 -235,8 +235,8 @@@ static void repack_promisor_objects(con
        while (strbuf_getline_lf(&line, out) != EOF) {
                char *promisor_name;
                int fd;
 -              if (line.len != 40)
 -                      die(_("repack: Expecting 40 character sha1 lines only from pack-objects."));
 +              if (line.len != the_hash_algo->hexsz)
-                       die("repack: Expecting full hex object ID lines only from pack-objects.");
++                      die(_("repack: Expecting full hex object ID lines only from pack-objects."));
                string_list_append(names, line.buf);
  
                /*
@@@ -407,8 -407,8 +407,8 @@@ int cmd_repack(int argc, const char **a
  
        out = xfdopen(cmd.out, "r");
        while (strbuf_getline_lf(&line, out) != EOF) {
 -              if (line.len != 40)
 -                      die(_("repack: Expecting 40 character sha1 lines only from pack-objects"));
 +              if (line.len != the_hash_algo->hexsz)
-                       die("repack: Expecting full hex object ID lines only from pack-objects.");
++                      die(_("repack: Expecting full hex object ID lines only from pack-objects."));
                string_list_append(&names, line.buf);
        }
        fclose(out);
diff --cc git.c
Simple merge
Simple merge
diff --cc parse-options.c
Simple merge
diff --cc parse-options.h
index a650a7d220bd972b10b7e4a30119e9de3b8ba23a,2e146aa6fabb0f9c10e28eacd7db9aee04a023b5..81380c22b62e3b55187705010fe459a795df1b0d
@@@ -186,25 -189,8 +186,22 @@@ extern NORETURN void usage_msg_opt(cons
                                   const struct option *options);
  
  extern int optbug(const struct option *opt, const char *reason);
- extern int opterror(const struct option *opt, const char *reason, int flags);
- #if defined(__GNUC__)
- #define opterror(o,r,f) (opterror((o),(r),(f)), const_error())
- #endif
+ const char *optname(const struct option *opt, int flags);
  
 +/*
 + * Use these assertions for callbacks that expect to be called with NONEG and
 + * NOARG respectively, and do not otherwise handle the "unset" and "arg"
 + * parameters.
 + */
 +#define BUG_ON_OPT_NEG(unset) do { \
 +      if ((unset)) \
 +              BUG("option callback does not expect negation"); \
 +} while (0)
 +#define BUG_ON_OPT_ARG(arg) do { \
 +      if ((arg)) \
 +              BUG("option callback does not expect an argument"); \
 +} while (0)
 +
  /*----- incremental advanced APIs -----*/
  
  enum {
diff --cc read-cache.c
index bd45dc3e24d7dc28820d26cc6e6d377f92fda46d,8d99ae376c066393c03db47db6650d578bd06f50..68534a9d48d4f0bf44661ed3497923ac0aa272be
@@@ -1491,17 -1492,11 +1492,17 @@@ int refresh_index(struct index_state *i
                                                  istate->cache_nr);
  
        trace_performance_enter();
-       modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n");
-       deleted_fmt = (in_porcelain ? "D\t%s\n" : "%s: needs update\n");
-       typechange_fmt = (in_porcelain ? "T\t%s\n" : "%s needs update\n");
-       added_fmt = (in_porcelain ? "A\t%s\n" : "%s needs update\n");
-       unmerged_fmt = (in_porcelain ? "U\t%s\n" : "%s: needs merge\n");
+       modified_fmt   = in_porcelain ? "M\t%s\n" : "%s: needs update\n";
+       deleted_fmt    = in_porcelain ? "D\t%s\n" : "%s: needs update\n";
+       typechange_fmt = in_porcelain ? "T\t%s\n" : "%s: needs update\n";
+       added_fmt      = in_porcelain ? "A\t%s\n" : "%s: needs update\n";
+       unmerged_fmt   = in_porcelain ? "U\t%s\n" : "%s: needs merge\n";
 +      /*
 +       * Use the multi-threaded preload_index() to refresh most of the
 +       * cache entries quickly then in the single threaded loop below,
 +       * we only have to do the special cases that are left.
 +       */
 +      preload_index(istate, pathspec, 0);
        for (i = 0; i < istate->cache_nr; i++) {
                struct cache_entry *ce, *new_entry;
                int cache_errno = 0;
diff --cc ref-filter.c
index 5de616befe46e64b014ebe7c3feb5913bc8af2df,0681359100ba11ca1bd502a9752404f39fea2de6..75281c73f21c78d118d3816286280751b89f57e0
@@@ -2320,13 -2300,13 +2320,15 @@@ int parse_opt_merge_filter(const struc
        struct object_id oid;
        int no_merged = starts_with(opt->long_name, "no");
  
 +      BUG_ON_OPT_NEG(unset);
 +
        if (rf->merge) {
                if (no_merged) {
-                       return opterror(opt, "is incompatible with --merged", 0);
+                       return error(_("option `%s' is incompatible with --merged"),
+                                    opt->long_name);
                } else {
-                       return opterror(opt, "is incompatible with --no-merged", 0);
+                       return error(_("option `%s' is incompatible with --no-merged"),
+                                    opt->long_name);
                }
        }
  
diff --cc remote.c
Simple merge
Simple merge
Simple merge
diff --cc t/t1450-fsck.sh
index e20e8fa8301607b94cff7c42e83545f072d5191f,15ca98b2a9da5900835e2e2eaf4ae11281288598..2e5e979336c5c67bf59667bbf5e0183b632ea2da
@@@ -98,44 -98,9 +98,44 @@@ test_expect_success 'HEAD link pointin
        # avoid corrupt/broken HEAD from interfering with repo discovery
        test_must_fail env GIT_DIR=.git git fsck 2>out &&
        cat out &&
-       grep "HEAD points to something strange" out
+       test_i18ngrep "HEAD points to something strange" out
  '
  
-       grep "main-worktree/HEAD: detached HEAD points" out
 +test_expect_success 'HEAD link pointing at a funny object (from different wt)' '
 +      test_when_finished "mv .git/SAVED_HEAD .git/HEAD" &&
 +      test_when_finished "rm -rf .git/worktrees wt" &&
 +      git worktree add wt &&
 +      mv .git/HEAD .git/SAVED_HEAD &&
 +      echo $ZERO_OID >.git/HEAD &&
 +      # avoid corrupt/broken HEAD from interfering with repo discovery
 +      test_must_fail git -C wt fsck 2>out &&
-       grep "worktrees/other/HEAD: detached HEAD points" out
++      test_i18ngrep "main-worktree/HEAD: detached HEAD points" out
 +'
 +
 +test_expect_success 'other worktree HEAD link pointing at a funny object' '
 +      test_when_finished "rm -rf .git/worktrees other" &&
 +      git worktree add other &&
 +      echo $ZERO_OID >.git/worktrees/other/HEAD &&
 +      test_must_fail git fsck 2>out &&
-       grep "worktrees/other/HEAD: invalid sha1 pointer" out
++      test_i18ngrep "worktrees/other/HEAD: detached HEAD points" out
 +'
 +
 +test_expect_success 'other worktree HEAD link pointing at missing object' '
 +      test_when_finished "rm -rf .git/worktrees other" &&
 +      git worktree add other &&
 +      echo "Contents missing from repo" | git hash-object --stdin >.git/worktrees/other/HEAD &&
 +      test_must_fail git fsck 2>out &&
-       grep "worktrees/other/HEAD points to something strange" out
++      test_i18ngrep "worktrees/other/HEAD: invalid sha1 pointer" out
 +'
 +
 +test_expect_success 'other worktree HEAD link pointing at a funny place' '
 +      test_when_finished "rm -rf .git/worktrees other" &&
 +      git worktree add other &&
 +      echo "ref: refs/funny/place" >.git/worktrees/other/HEAD &&
 +      test_must_fail git fsck 2>out &&
++      test_i18ngrep "worktrees/other/HEAD points to something strange" out
 +'
 +
  test_expect_success 'email without @ is okay' '
        git cat-file commit HEAD >basis &&
        sed "s/@/AT/" basis >okay &&
index 336f02a41a66b48269e8eb6030d5323cffb8b686,6391437529ca7c4f742d2668fdefc77df1112743..9643acb1615fe0d28a7f0e386fa69a570a93dc8e
@@@ -281,7 -239,7 +281,7 @@@ test_expect_success 'upon cloning, chec
        test_must_fail git -c protocol.version=2 clone \
                --filter=blob:none $HTTPD_URL/one_time_sed/server repo 2>err &&
  
--      grep "did not send all necessary objects" err &&
++      test_i18ngrep "did not send all necessary objects" err &&
  
        # Ensure that the one-time-sed script was used.
        ! test -e "$HTTPD_ROOT_PATH/one-time-sed"
index 3f58f05cbb49d3b4a7f50e946e0f46bbc953140a,3f58f05cbb49d3b4a7f50e946e0f46bbc953140a..7053899cb5a0cbd5cca10cb4029b70df866dbff8
@@@ -208,7 -208,7 +208,7 @@@ test_expect_success 'server is initiall
        cp -r "$LOCAL_PRISTINE" local &&
        inconsistency master 1234567890123456789012345678901234567890 &&
        test_must_fail git -C local fetch 2>err &&
--      grep "ERR upload-pack: not our ref" err
++      test_i18ngrep "ERR upload-pack: not our ref" err
  '
  
  test_expect_success 'server is initially ahead - ref in want' '
@@@ -254,7 -254,7 +254,7 @@@ test_expect_success 'server loses a re
        echo "s/master/raster/" >"$HTTPD_ROOT_PATH/one-time-sed" &&
        test_must_fail git -C local fetch 2>err &&
  
--      grep "ERR unknown ref refs/heads/raster" err
++      test_i18ngrep "ERR unknown ref refs/heads/raster" err
  '
  
  stop_httpd
Simple merge