Skip to content

Commit

Permalink
Merge branch 'ab/i18n-fixup'
Browse files Browse the repository at this point in the history
* ab/i18n-fixup: (24 commits)
  i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811
  i18n: use test_i18n{grep,cmp} in t7508
  i18n: use test_i18ngrep in t7506
  i18n: use test_i18ngrep and test_i18ncmp in t7502
  i18n: use test_i18ngrep in t7501
  i18n: use test_i18ncmp in t7500
  i18n: use test_i18ngrep in t7201
  i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110
  i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060
  i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014
  i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507
  i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200
  i18n: use test_i18ngrep in lib-httpd and t2019
  i18n: do not overuse C_LOCALE_OUTPUT (grep)
  i18n: use test_i18ncmp in t1200 and t2200
  i18n: .git file is not a human readable message (t5601)
  i18n: do not overuse C_LOCALE_OUTPUT
  i18n: mark init-db messages for translation
  i18n: mark checkout plural warning for translation
  i18n: mark checkout --detach messages for translation
  ...
  • Loading branch information
Junio C Hamano committed May 2, 2011
2 parents 0d405d7 + c9ea118 commit a75c352
Show file tree
Hide file tree
Showing 40 changed files with 375 additions and 383 deletions.
24 changes: 18 additions & 6 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,18 +648,30 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
if (more == 1)
describe_one_orphan(&sb, last);
else
strbuf_addf(&sb, " ... and %d more.\n", more);
strbuf_addf(&sb, _(" ... and %d more.\n"), more);
}

fprintf(stderr,
"Warning: you are leaving %d commit%s behind, "
Q_(
/* The singular version */
"Warning: you are leaving %d commit behind, "
"not connected to\n"
"any of your branches:\n\n"
"%s\n"
"If you want to keep it by creating a new branch, "
"this may be a good time\nto do so with:\n\n"
" git branch new_branch_name %s\n\n",
/* The plural version */
"Warning: you are leaving %d commits behind, "
"not connected to\n"
"any of your branches:\n\n"
"%s\n"
"If you want to keep them by creating a new branch, "
"this may be a good time\nto do so with:\n\n"
" git branch new_branch_name %s\n\n",
lost, ((1 < lost) ? "s" : ""),
/* Give ngettext() the count */
lost),
lost,
sb.buf,
sha1_to_hex(commit->object.sha1));
strbuf_release(&sb);
Expand Down Expand Up @@ -961,9 +973,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
die (_("--patch is incompatible with all other options"));

if (opts.force_detach && (opts.new_branch || opts.new_orphan_branch))
die("--detach cannot be used with -b/-B/--orphan");
die(_("--detach cannot be used with -b/-B/--orphan"));
if (opts.force_detach && 0 < opts.track)
die("--detach cannot be used with -t");
die(_("--detach cannot be used with -t"));

/* --track without -b should DWIM */
if (0 < opts.track && !opts.new_branch) {
Expand Down Expand Up @@ -1043,7 +1055,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
}

if (opts.force_detach)
die("git checkout: --detach does not take a path argument");
die(_("git checkout: --detach does not take a path argument"));

if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));
Expand Down
2 changes: 1 addition & 1 deletion builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (path)
repo = xstrdup(absolute_path(repo_name));
else if (!strchr(repo_name, ':'))
die("repository '%s' does not exist", repo_name);
die(_("repository '%s' does not exist"), repo_name);
else
repo = repo_name;
is_local = path && !is_bundle;
Expand Down
10 changes: 5 additions & 5 deletions builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,
struct stat st;

if (!exist_ok && !stat(git_dir, &st))
die("%s already exists", git_dir);
die(_("%s already exists"), git_dir);

if (!exist_ok && !stat(real_git_dir, &st))
die("%s already exists", real_git_dir);
die(_("%s already exists"), real_git_dir);

/*
* make sure symlinks are resolved because we'll be
Expand Down Expand Up @@ -351,15 +351,15 @@ static void separate_git_dir(const char *git_dir)
else if (S_ISDIR(st.st_mode))
src = git_link;
else
die("unable to handle file type %d", st.st_mode);
die(_("unable to handle file type %d"), st.st_mode);

if (rename(src, git_dir))
die_errno("unable to move %s to %s", src, git_dir);
die_errno(_("unable to move %s to %s"), src, git_dir);
}

fp = fopen(git_link, "w");
if (!fp)
die("Could not create git link %s", git_link);
die(_("Could not create git link %s"), git_link);
fprintf(fp, "gitdir: %s\n", git_dir);
fclose(fp);
}
Expand Down
16 changes: 8 additions & 8 deletions builtin/merge.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ static void read_merge_msg(void)
{
strbuf_reset(&merge_msg);
if (strbuf_read_file(&merge_msg, git_path("MERGE_MSG"), 0) < 0)
die_errno("Could not read from '%s'", git_path("MERGE_MSG"));
die_errno(_("Could not read from '%s'"), git_path("MERGE_MSG"));
}

static void run_prepare_commit_msg(void)
Expand Down Expand Up @@ -962,16 +962,16 @@ static int setup_with_upstream(const char ***argv)
const char **args;

if (!branch)
die("No current branch.");
die(_("No current branch."));
if (!branch->remote)
die("No remote for the current branch.");
die(_("No remote for the current branch."));
if (!branch->merge_nr)
die("No default upstream defined for the current branch.");
die(_("No default upstream defined for the current branch."));

args = xcalloc(branch->merge_nr + 1, sizeof(char *));
for (i = 0; i < branch->merge_nr; i++) {
if (!branch->merge[i]->dst)
die("No remote tracking branch for %s from %s",
die(_("No remote tracking branch for %s from %s"),
branch->merge[i]->src, branch->remote_name);
args[i] = branch->merge[i]->dst;
}
Expand Down Expand Up @@ -1043,10 +1043,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
if (advice_resolve_conflict)
die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
"Please, commit your changes before you can merge.");
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
"Please, commit your changes before you can merge."));
else
die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).");
die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)."));
}
resolve_undo_clear();

Expand Down
5 changes: 2 additions & 3 deletions t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ test_http_push_nonff() {
grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
'

test_expect_success C_LOCALE_OUTPUT 'non-fast-forward push shows help message' '
grep "To prevent you from losing history, non-fast-forward updates were rejected" \
output
test_expect_success 'non-fast-forward push shows help message' '
test_i18ngrep "To prevent you from losing history, non-fast-forward updates were rejected" output
'
}
10 changes: 5 additions & 5 deletions t/t0001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
fi
'

test_expect_success C_LOCALE_OUTPUT 'reinit' '
test_expect_success 'reinit' '
(
sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
Expand All @@ -190,11 +190,11 @@ test_expect_success C_LOCALE_OUTPUT 'reinit' '
git init >out1 2>err1 &&
git init >out2 2>err2
) &&
grep "Initialized empty" again/out1 &&
grep "Reinitialized existing" again/out2 &&
test_i18ngrep "Initialized empty" again/out1 &&
test_i18ngrep "Reinitialized existing" again/out2 &&
>again/empty &&
test_cmp again/empty again/err1 &&
test_cmp again/empty again/err2
test_i18ncmp again/empty again/err1 &&
test_i18ncmp again/empty again/err2
'

test_expect_success 'init with --template' '
Expand Down
4 changes: 2 additions & 2 deletions t/t1200-tutorial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ test_expect_success 'git resolve' '
-e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output
'

test_expect_success C_LOCALE_OUTPUT 'git resolve output' '
test_cmp resolve.expect resolve.output
test_expect_success 'git resolve output' '
test_i18ncmp resolve.expect resolve.output
'

cat > show-branch2.expect << EOF
Expand Down
12 changes: 6 additions & 6 deletions t/t2019-checkout-ambiguous-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ test_expect_success 'checkout chooses branch over tag' '
test_cmp expect file
'

test_expect_success C_LOCALE_OUTPUT 'checkout reports switch to branch' '
grep "Switched to branch" stderr &&
! grep "^HEAD is now at" stderr
test_expect_success 'checkout reports switch to branch' '
test_i18ngrep "Switched to branch" stderr &&
test_i18ngrep ! "^HEAD is now at" stderr
'

test_expect_success 'checkout vague ref succeeds' '
Expand All @@ -51,9 +51,9 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' '
test_cmp expect file
'

test_expect_success VAGUENESS_SUCCESS,C_LOCALE_OUTPUT 'checkout reports switch to branch' '
grep "Switched to branch" stderr &&
! grep "^HEAD is now at" stderr
test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' '
test_i18ngrep "Switched to branch" stderr &&
test_i18ngrep ! "^HEAD is now at" stderr
'

test_done
19 changes: 14 additions & 5 deletions t/t2020-checkout-detach.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ check_not_detached () {

ORPHAN_WARNING='you are leaving .* commit.*behind'
check_orphan_warning() {
grep "$ORPHAN_WARNING" "$1"
test_i18ngrep "$ORPHAN_WARNING" "$1"
}
check_no_orphan_warning() {
! grep "$ORPHAN_WARNING" "$1"
test_i18ngrep ! "$ORPHAN_WARNING" "$1"
}

reset () {
Expand Down Expand Up @@ -108,21 +108,30 @@ test_expect_success 'checkout warns on orphan commits' '
echo content >orphan &&
git add orphan &&
git commit -a -m orphan &&
git checkout master 2>stderr &&
git checkout master 2>stderr
'

test_expect_success 'checkout warns on orphan commits: output' '
check_orphan_warning stderr
'

test_expect_success 'checkout does not warn leaving ref tip' '
reset &&
git checkout --detach two &&
git checkout master 2>stderr &&
git checkout master 2>stderr
'

test_expect_success 'checkout does not warn leaving ref tip' '
check_no_orphan_warning stderr
'

test_expect_success 'checkout does not warn leaving reachable commit' '
reset &&
git checkout --detach HEAD^ &&
git checkout master 2>stderr &&
git checkout master 2>stderr
'

test_expect_success 'checkout does not warn leaving reachable commit' '
check_no_orphan_warning stderr
'

Expand Down
4 changes: 2 additions & 2 deletions t/t2200-add-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test_expect_success 'touch and then add explicitly' '
'

test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' '
test_expect_success 'add -n -u should not add but just report' '
(
echo "add '\''check'\''" &&
Expand All @@ -124,7 +124,7 @@ test_expect_success C_LOCALE_OUTPUT 'add -n -u should not add but just report' '
after=$(git ls-files -s check top) &&
test "$before" = "$after" &&
test_cmp expect actual
test_i18ncmp expect actual
'

Expand Down
16 changes: 8 additions & 8 deletions t/t2204-add-ignored.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ do
! test -s out
'

test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i output" '
grep -e "Use -f if" err
test_expect_success "complaints for ignored $i output" '
test_i18ngrep -e "Use -f if" err
'

test_expect_success "complaints for ignored $i with unignored file" '
Expand All @@ -44,8 +44,8 @@ do
git ls-files "$i" >out &&
! test -s out
'
test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i with unignored file output" '
grep -e "Use -f if" err
test_expect_success "complaints for ignored $i with unignored file output" '
test_i18ngrep -e "Use -f if" err
'
done

Expand All @@ -61,10 +61,10 @@ do
)
'

test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in dir output" '
test_expect_success "complaints for ignored $i in dir output" '
(
cd dir &&
grep -e "Use -f if" err
test_i18ngrep -e "Use -f if" err
)
'
done
Expand All @@ -81,10 +81,10 @@ do
)
'

test_expect_success C_LOCALE_OUTPUT "complaints for ignored $i in sub output" '
test_expect_success "complaints for ignored $i in sub output" '
(
cd sub &&
grep -e "Use -f if" err
test_i18ngrep -e "Use -f if" err
)
'
done
Expand Down
8 changes: 4 additions & 4 deletions t/t3030-merge-recursive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,20 @@ test_expect_success 'merge-recursive result' '
'

test_expect_success C_LOCALE_OUTPUT 'fail if the index has unresolved entries' '
test_expect_success 'fail if the index has unresolved entries' '
rm -fr [abcd] &&
git checkout -f "$c1" &&
test_must_fail git merge "$c5" &&
test_must_fail git merge "$c5" 2> out &&
grep "not possible because you have unmerged files" out &&
test_i18ngrep "not possible because you have unmerged files" out &&
git add -u &&
test_must_fail git merge "$c5" 2> out &&
grep "You have not concluded your merge" out &&
test_i18ngrep "You have not concluded your merge" out &&
rm -f .git/MERGE_HEAD &&
test_must_fail git merge "$c5" 2> out &&
grep "Your local changes to the following files would be overwritten by merge:" out
test_i18ngrep "Your local changes to the following files would be overwritten by merge:" out
'

test_expect_success 'merge-recursive remove conflict' '
Expand Down
6 changes: 4 additions & 2 deletions t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ test_expect_success 'test deleting branch deletes branch config' \
test -z "$(git config branch.my7.remote)" &&
test -z "$(git config branch.my7.merge)"'

test_expect_success C_LOCALE_OUTPUT 'test deleting branch without config' \
test_expect_success 'test deleting branch without config' \
'git branch my7 s &&
sha1=$(git rev-parse my7 | cut -c 1-7) &&
test "$(git branch -d my7 2>&1)" = "Deleted branch my7 (was $sha1)."'
echo "Deleted branch my7 (was $sha1)." >expect &&
git branch -d my7 >actual 2>&1 &&
test_i18ncmp expect actual'

test_expect_success 'test --track without .fetch entries' \
'git branch --track my8 &&
Expand Down
4 changes: 2 additions & 2 deletions t/t3203-branch-output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ cat >expect <<'EOF'
branch-two
master
EOF
test_expect_success C_LOCALE_OUTPUT 'git branch shows detached HEAD properly' '
test_expect_success 'git branch shows detached HEAD properly' '
git checkout HEAD^0 &&
git branch >actual &&
test_cmp expect actual
test_i18ncmp expect actual
'

test_done
4 changes: 2 additions & 2 deletions t/t3501-revert-cherry-pick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
)
'

test_expect_success C_LOCALE_OUTPUT 'revert forbidden on dirty working tree' '
test_expect_success 'revert forbidden on dirty working tree' '
echo content >extra_file &&
git add extra_file &&
test_must_fail git revert HEAD 2>errors &&
grep "Your local changes would be overwritten by " errors
test_i18ngrep "Your local changes would be overwritten by " errors
'

Expand Down
Loading

0 comments on commit a75c352

Please sign in to comment.