* 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
  ...
This commit is contained in:
Junio C Hamano 2011-05-02 15:58:40 -07:00
Родитель 0d405d72f5 c9ea118e75
Коммит a75c3523d3
40 изменённых файлов: 375 добавлений и 383 удалений

Просмотреть файл

@ -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);
@ -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) {
@ -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."));

Просмотреть файл

@ -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;

Просмотреть файл

@ -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
@ -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);
}

Просмотреть файл

@ -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)
@ -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;
}
@ -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();

Просмотреть файл

@ -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
'
}

Просмотреть файл

@ -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 &&
@ -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' '

Просмотреть файл

@ -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

Просмотреть файл

@ -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' '
@ -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

Просмотреть файл

@ -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 () {
@ -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
'

Просмотреть файл

@ -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'\''" &&
@ -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
'

Просмотреть файл

@ -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" '
@ -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
@ -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
@ -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

Просмотреть файл

@ -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' '

Просмотреть файл

@ -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 &&

Просмотреть файл

@ -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

Просмотреть файл

@ -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
'

Просмотреть файл

@ -44,7 +44,7 @@ test_expect_success 'failed cherry-pick does not advance HEAD' '
test "$head" = "$newhead"
'
test_expect_success C_LOCALE_OUTPUT 'advice from failed cherry-pick' "
test_expect_success 'advice from failed cherry-pick' "
pristine_detach initial &&
picked=\$(git rev-parse --short picked) &&
@ -56,7 +56,7 @@ test_expect_success C_LOCALE_OUTPUT 'advice from failed cherry-pick' "
EOF
test_must_fail git cherry-pick picked 2>actual &&
test_cmp expected actual
test_i18ncmp expected actual
"
test_expect_success 'failed cherry-pick sets CHERRY_PICK_HEAD' '

Просмотреть файл

@ -271,9 +271,9 @@ test_expect_success 'git add --dry-run of non-existing file' "
test_must_fail git add --dry-run track-this ignored-file >actual 2>&1
"
test_expect_success C_LOCALE_OUTPUT 'git add --dry-run of an existing file output' "
test_expect_success 'git add --dry-run of an existing file output' "
echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect &&
test_cmp expect actual
test_i18ncmp expect actual
"
cat >expect.err <<\EOF
@ -290,9 +290,9 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err
'
test_expect_success C_LOCALE_OUTPUT 'git add --dry-run --ignore-missing of non-existing file output' '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
test_expect_success 'git add --dry-run --ignore-missing of non-existing file output' '
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_done

Просмотреть файл

@ -64,18 +64,18 @@ test_expect_success \
'validate the output.' \
'compare_diff_patch current expected'
test_expect_success C_LOCALE_OUTPUT 'favour same basenames over different ones' '
test_expect_success 'favour same basenames over different ones' '
cp path1 another-path &&
git add another-path &&
git commit -m 1 &&
git rm path1 &&
mkdir subdir &&
git mv another-path subdir/path1 &&
git status | grep "renamed: .*path1 -> subdir/path1"'
git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
test_expect_success C_LOCALE_OUTPUT 'favour same basenames even with minor differences' '
test_expect_success 'favour same basenames even with minor differences' '
git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
git status | grep "renamed: .*path1 -> subdir/path1"'
git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
test_expect_success 'setup for many rename source candidates' '
git reset --hard &&

Просмотреть файл

@ -614,13 +614,13 @@ echo "fatal: --name-only does not make sense" > expect.name-only
echo "fatal: --name-status does not make sense" > expect.name-status
echo "fatal: --check does not make sense" > expect.check
test_expect_success C_LOCALE_OUTPUT 'options no longer allowed for format-patch' '
test_expect_success 'options no longer allowed for format-patch' '
test_must_fail git format-patch --name-only 2> output &&
test_cmp expect.name-only output &&
test_i18ncmp expect.name-only output &&
test_must_fail git format-patch --name-status 2> output &&
test_cmp expect.name-status output &&
test_i18ncmp expect.name-status output &&
test_must_fail git format-patch --check 2> output &&
test_cmp expect.check output'
test_i18ncmp expect.check output'
test_expect_success 'format-patch --numstat should produce a patch' '
git format-patch --numstat --stdout master..side > output &&

Просмотреть файл

@ -66,12 +66,9 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
(
cd downstream &&
git fetch --recurse-submodules >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "fetch --recurse-submodules recurses into submodules: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "fetch alone only fetches superproject" '
@ -98,12 +95,9 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
cd downstream &&
git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
git fetch >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "--no-recurse-submodules overrides .gitmodules config" '
@ -132,12 +126,9 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
git fetch --recurse-submodules >../actual.out 2>../actual.err &&
git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
git config --unset submodule.submodule.fetchRecurseSubmodules
)
'
test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "--quiet propagates to submodules" '
@ -154,24 +145,18 @@ test_expect_success "--dry-run propagates to submodules" '
(
cd downstream &&
git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "--dry-run propagates to submodules: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "Without --dry-run propagates to submodules" '
(
cd downstream &&
git fetch --recurse-submodules >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "Without --dry-run propagates to submodules: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "recurseSubmodules=true propagates into submodules" '
@ -180,12 +165,9 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
cd downstream &&
git config fetch.recurseSubmodules true
git fetch >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "recurseSubmodules=true propagates into submodules: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "--recurse-submodules overrides config in submodule" '
@ -197,12 +179,9 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
git config fetch.recurseSubmodules false
) &&
git fetch --recurse-submodules >../actual.out 2>../actual.err
)
'
test_expect_success C_LOCALE_OUTPUT "--recurse-submodules overrides config in submodule: output" '
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
) &&
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "--no-recurse-submodules overrides config setting" '
@ -243,8 +222,8 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
test_cmp expect.err.sub actual.err &&
test_cmp expect.out.sub actual.out
test_i18ncmp expect.err.sub actual.err &&
test_i18ncmp expect.out.sub actual.out
'
test_expect_success "Recursion doesn't happen when new superproject commits don't change any submodules" '
@ -261,7 +240,7 @@ test_expect_success "Recursion doesn't happen when new superproject commits don'
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_cmp expect.err.file actual.err
test_i18ncmp expect.err.file actual.err
'
test_expect_success "Recursion picks up config in submodule" '
@ -289,8 +268,8 @@ test_expect_success "Recursion picks up config in submodule" '
git config --unset fetch.recurseSubmodules
)
) &&
test_cmp expect.err.sub actual.err &&
test_cmp expect.out actual.out
test_i18ncmp expect.err.sub actual.err &&
test_i18ncmp expect.out actual.out
'
test_expect_success "Recursion picks up all submodules when necessary" '
@ -321,8 +300,8 @@ test_expect_success "Recursion picks up all submodules when necessary" '
cd downstream &&
git fetch >../actual.out 2>../actual.err
) &&
test_cmp expect.err.2 actual.err &&
test_cmp expect.out actual.out
test_i18ncmp expect.err.2 actual.err &&
test_i18ncmp expect.out actual.out
'
test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no new commits are fetched in the superproject (and ignores config)" '
@ -375,8 +354,8 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
git config --unset -f .gitmodules submodule.deepsubmodule.fetchRecursive
)
) &&
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err
test_i18ncmp expect.out actual.out &&
test_i18ncmp expect.err actual.err
'
test_expect_success "'--recurse-submodules=on-demand' stops when no new submodule commits are found in the superproject (and ignores config)" '
@ -393,7 +372,7 @@ test_expect_success "'--recurse-submodules=on-demand' stops when no new submodul
git fetch --recurse-submodules=on-demand >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_cmp expect.err.file actual.err
test_i18ncmp expect.err.file actual.err
'
test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
@ -420,8 +399,8 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
cd downstream &&
git config --unset fetch.recurseSubmodules
) &&
test_cmp expect.out.sub actual.out &&
test_cmp expect.err.2 actual.err
test_i18ncmp expect.out.sub actual.out &&
test_i18ncmp expect.err.2 actual.err
'
test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' overrides fetch.recurseSubmodules" '
@ -448,8 +427,8 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
cd downstream &&
git config --unset submodule.submodule.fetchRecurseSubmodules
) &&
test_cmp expect.out.sub actual.out &&
test_cmp expect.err.2 actual.err
test_i18ncmp expect.out.sub actual.out &&
test_i18ncmp expect.err.2 actual.err
'
test_expect_success "don't fetch submodule when newly recorded commits are already present" '
@ -468,7 +447,7 @@ test_expect_success "don't fetch submodule when newly recorded commits are alrea
git fetch >../actual.out 2>../actual.err
) &&
! test -s actual.out &&
test_cmp expect.err actual.err
test_i18ncmp expect.err actual.err
'
test_done

Просмотреть файл

@ -135,8 +135,8 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
'
test_expect_success C_LOCALE_OUTPUT 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
grep "To prevent you from losing history, non-fast-forward updates were rejected" \
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
test_i18ngrep "To prevent you from losing history, non-fast-forward updates were rejected" \
output
'

Просмотреть файл

@ -194,11 +194,14 @@ test_expect_success 'do not respect url-encoding of non-url path' '
test_expect_success 'clone separate gitdir' '
rm -rf dst &&
git clone --separate-git-dir realgitdir src dst &&
echo "gitdir: `pwd`/realgitdir" >expected &&
test_cmp expected dst/.git &&
test -d realgitdir/refs
'
test_expect_success 'clone separate gitdir: output' '
echo "gitdir: `pwd`/realgitdir" >expected &&
test_cmp expected dst/.git
'
test_expect_success 'clone separate gitdir where target already exists' '
rm -rf dst &&
test_must_fail git clone --separate-git-dir realgitdir src dst

Просмотреть файл

@ -42,13 +42,13 @@ b3 behind 1
b4 ahead 2
EOF
test_expect_success C_LOCALE_OUTPUT 'branch -v' '
test_expect_success 'branch -v' '
(
cd test &&
git branch -v
) |
sed -n -e "$script" >actual &&
test_cmp expect actual
test_i18ncmp expect actual
'
test_expect_success 'checkout' '

Просмотреть файл

@ -123,8 +123,8 @@ cat - >err.expect <<EOF
warning: tag 'A' is really 'Q' here
EOF
check_describe A-* HEAD
test_expect_success C_LOCALE_OUTPUT 'warning was displayed for Q' '
test_cmp err.expect err.actual
test_expect_success 'warning was displayed for Q' '
test_i18ncmp err.expect err.actual
'
test_expect_success 'rename tag Q back to A' '
mv .git/refs/tags/Q .git/refs/tags/A

Просмотреть файл

@ -1120,13 +1120,11 @@ test_expect_success \
! (GIT_EDITOR=cat git tag -a initial-comment > actual)
'
test_expect_success \
C_LOCALE_OUTPUT \
'message in editor has initial comment: first line' '
test_expect_success 'message in editor has initial comment: first line' '
# check the first line --- should be empty
echo >first.expect &&
sed -e 1q <actual >first.actual &&
test_cmp first.expect first.actual
test_i18ncmp first.expect first.actual
'
test_expect_success \

Просмотреть файл

@ -124,16 +124,16 @@ cat >expected <<EOF
Would remove expected
Would remove result
EOF
test_expect_success C_LOCALE_OUTPUT 'git-clean, absent case' '
test_expect_success 'git-clean, absent case' '
setup_absent &&
git clean -n > result &&
test_cmp expected result
test_i18ncmp expected result
'
test_expect_success C_LOCALE_OUTPUT 'git-clean, dirty case' '
test_expect_success 'git-clean, dirty case' '
setup_dirty &&
git clean -n > result &&
test_cmp expected result
test_i18ncmp expected result
'
#TODO test_expect_failure 'git-apply adds file' false

Просмотреть файл

@ -38,7 +38,7 @@ cat >expect <<EOF
no changes added to commit (use "git add" and/or "git commit -a")
EOF
test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' '
test_expect_success 'M/D conflict does not segfault' '
mkdir mdconflict &&
(
cd mdconflict &&
@ -50,9 +50,9 @@ test_expect_success C_LOCALE_OUTPUT 'M/D conflict does not segfault' '
git commit -m delete &&
test_must_fail git merge master &&
test_must_fail git commit --dry-run >../actual &&
test_cmp ../expect ../actual &&
test_i18ncmp ../expect ../actual &&
git status >../actual &&
test_cmp ../expect ../actual
test_i18ncmp ../expect ../actual
)
'

Просмотреть файл

@ -423,10 +423,10 @@ Unstaged changes after reset:
M file2
EOF
test_expect_success C_LOCALE_OUTPUT '--mixed refreshes the index' '
test_expect_success '--mixed refreshes the index' '
echo 123 >> file2 &&
git reset --mixed HEAD > output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success 'disambiguation (1)' '

Просмотреть файл

@ -233,11 +233,11 @@ test_expect_success '"reset --merge HEAD^" is ok with pending merge' '
# working index HEAD target working index HEAD
# ----------------------------------------------------
# file1: X U B C --keep (disallowed)
test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD^" fails with pending merge' '
test_expect_success '"reset --keep HEAD^" fails with pending merge' '
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD^ 2>err.log &&
grep "middle of a merge" err.log
test_i18ngrep "middle of a merge" err.log
'
# The next test will test the following:
@ -259,11 +259,11 @@ test_expect_success '"reset --merge HEAD" is ok with pending merge' '
# working index HEAD target working index HEAD
# ----------------------------------------------------
# file1: X U B B --keep (disallowed)
test_expect_success C_LOCALE_OUTPUT '"reset --keep HEAD" fails with pending merge' '
test_expect_success '"reset --keep HEAD" fails with pending merge' '
git reset --hard third &&
test_must_fail git merge branch1 &&
test_must_fail git reset --keep HEAD 2>err.log &&
grep "middle of a merge" err.log
test_i18ngrep "middle of a merge" err.log
'
test_expect_success '--merge is ok with added/deleted merge' '
@ -280,7 +280,7 @@ test_expect_success '--merge is ok with added/deleted merge' '
git diff --exit-code --cached
'
test_expect_success C_LOCALE_OUTPUT '--keep fails with added/deleted merge' '
test_expect_success '--keep fails with added/deleted merge' '
git reset --hard third &&
rm -f file2 &&
test_must_fail git merge branch3 &&
@ -289,7 +289,7 @@ test_expect_success C_LOCALE_OUTPUT '--keep fails with added/deleted merge' '
git diff --exit-code file3 &&
git diff --exit-code branch3 file3 &&
test_must_fail git reset --keep HEAD 2>err.log &&
grep "middle of a merge" err.log
test_i18ngrep "middle of a merge" err.log
'
test_done

Просмотреть файл

@ -223,12 +223,12 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
test_cmp two expect
'
test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD (with advice declined)' '
test_expect_success 'checkout to detach HEAD (with advice declined)' '
git config advice.detachedHead false &&
git checkout -f renamer && git clean -f &&
git checkout renamer^ 2>messages &&
grep "HEAD is now at 7329388" messages &&
test_i18ngrep "HEAD is now at 7329388" messages &&
test 1 -eq $(wc -l <messages) &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
@ -242,11 +242,11 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD (with advice declin
fi
'
test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD' '
test_expect_success 'checkout to detach HEAD' '
git config advice.detachedHead true &&
git checkout -f renamer && git clean -f &&
git checkout renamer^ 2>messages &&
grep "HEAD is now at 7329388" messages &&
test_i18ngrep "HEAD is now at 7329388" messages &&
test 1 -lt $(wc -l <messages) &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
@ -260,7 +260,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD' '
fi
'
test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with branchname^' '
test_expect_success 'checkout to detach HEAD with branchname^' '
git checkout -f master && git clean -f &&
git checkout renamer^ &&
@ -276,7 +276,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with branchname^' '
fi
'
test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with :/message' '
test_expect_success 'checkout to detach HEAD with :/message' '
git checkout -f master && git clean -f &&
git checkout ":/Initial" &&
@ -292,7 +292,7 @@ test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with :/message' '
fi
'
test_expect_success C_LOCALE_OUTPUT 'checkout to detach HEAD with HEAD^0' '
test_expect_success 'checkout to detach HEAD with HEAD^0' '
git checkout -f master && git clean -f &&
git checkout HEAD^0 &&

Просмотреть файл

@ -15,7 +15,7 @@ commit_msg_is () {
printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect &&
printf "%s" "$1" >$actual &&
test_cmp $expect $actual
test_i18ncmp $expect $actual
}
# A sanity check to see if commit is working at all.
@ -72,7 +72,7 @@ test_expect_success 'adding comments to a template should not commit' '
)
'
test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should commit' '
test_expect_success 'adding real content to a template should commit' '
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit --template "$TEMPLATE"
@ -80,7 +80,7 @@ test_expect_success C_LOCALE_OUTPUT 'adding real content to a template should co
commit_msg_is "template linecommit message"
'
test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' '
test_expect_success '-t option should be short for --template' '
echo "short template" > "$TEMPLATE" &&
echo "new content" >> foo &&
git add foo &&
@ -91,7 +91,7 @@ test_expect_success C_LOCALE_OUTPUT '-t option should be short for --template' '
commit_msg_is "short templatecommit message"
'
test_expect_success C_LOCALE_OUTPUT 'config-specified template should commit' '
test_expect_success 'config-specified template should commit' '
echo "new template" > "$TEMPLATE" &&
git config commit.template "$TEMPLATE" &&
echo "more content" >> foo &&
@ -290,7 +290,7 @@ test_expect_success 'commit --squash works with -c for same commit' '
commit_msg_is "squash! edited commit"
'
test_expect_success C_LOCALE_OUTPUT 'commit --squash works with editor' '
test_expect_success 'commit --squash works with editor' '
commit_for_rebase_autosquash_setup &&
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit --squash HEAD~1 &&

Просмотреть файл

@ -16,9 +16,10 @@ test_expect_success \
"echo 'bongo bongo' >file &&
git add file"
test_expect_success C_LOCALE_OUTPUT \
"Constructing initial commit" \
"git status | grep 'Initial commit'"
test_expect_success "Constructing initial commit" '
git status >actual &&
test_i18ngrep "Initial commit" actual
'
test_expect_success \
"fail initial amend" \

Просмотреть файл

@ -22,10 +22,7 @@ check_summary_oneline() {
SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
if test_have_prereq C_LOCALE_OUTPUT
then
test_cmp exp act
fi
test_i18ncmp exp act
}
test_expect_success 'output summary format' '
@ -234,23 +231,19 @@ echo "sample
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit." >expect
test_expect_success C_LOCALE_OUTPUT 'cleanup commit messages (strip,-F,-e): output' '
test_cmp expect actual
test_expect_success 'cleanup commit messages (strip,-F,-e): output' '
test_i18ncmp expect actual
'
echo "#
# Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
#" >> expect
test_expect_success C_LOCALE_OUTPUT 'author different from committer' '
test_expect_success 'author different from committer' '
echo >>negative &&
git commit -e -m "sample"
head -n 7 .git/COMMIT_EDITMSG >actual
'
test_expect_success C_LOCALE_OUTPUT 'author different from committer: output' '
test_cmp expect actual
test_might_fail git commit -e -m "sample" &&
head -n 7 .git/COMMIT_EDITMSG >actual &&
test_i18ncmp expect actual
'
mv expect expect.tmp
@ -259,7 +252,7 @@ rm -f expect.tmp
echo "# Committer:
#" >> expect
test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
test_expect_success 'committer is automatic' '
echo >>negative &&
(
@ -270,10 +263,7 @@ test_expect_success C_LOCALE_OUTPUT 'committer is automatic' '
) &&
head -n 8 .git/COMMIT_EDITMSG | \
sed "s/^# Committer: .*/# Committer:/" >actual
'
test_expect_success C_LOCALE_OUTPUT 'committer is automatic: output' '
test_cmp expect actual
test_i18ncmp expect actual
'
pwd=`pwd`
@ -376,78 +366,78 @@ try_commit () {
GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template &&
case "$use_template" in
'')
! grep "^## Custom template" .git/COMMIT_EDITMSG ;;
test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;;
*)
grep "^## Custom template" .git/COMMIT_EDITMSG ;;
test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;;
esac
}
try_commit_status_combo () {
test_expect_success C_LOCALE_OUTPUT 'commit' '
test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit' '
test_expect_success 'commit' '
clear_config commit.status &&
try_commit "" &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --status' '
test_expect_success 'commit --status' '
clear_config commit.status &&
try_commit --status &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --no-status' '
test_expect_success 'commit --no-status' '
clear_config commit.status &&
try_commit --no-status &&
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = yes' '
test_expect_success 'commit with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
try_commit "" &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit with commit.status = no' '
test_expect_success 'commit with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
try_commit "" &&
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = yes' '
test_expect_success 'commit --status with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
try_commit --status &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = yes' '
test_expect_success 'commit --no-status with commit.status = yes' '
clear_config commit.status &&
git config commit.status yes &&
try_commit --no-status &&
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --status with commit.status = no' '
test_expect_success 'commit --status with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
try_commit --status &&
grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
test_expect_success C_LOCALE_OUTPUT 'commit --no-status with commit.status = no' '
test_expect_success 'commit --no-status with commit.status = no' '
clear_config commit.status &&
git config commit.status no &&
try_commit --no-status &&
! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG
'
}

Просмотреть файл

@ -20,21 +20,21 @@ test_expect_success 'setup' '
git commit -m "Add submodule sub"
'
test_expect_success C_LOCALE_OUTPUT 'status clean' '
test_expect_success 'status clean' '
git status >output &&
grep "nothing to commit" output
test_i18ngrep "nothing to commit" output
'
test_expect_success C_LOCALE_OUTPUT 'commit --dry-run -a clean' '
test_expect_success 'commit --dry-run -a clean' '
test_must_fail git commit --dry-run -a >output &&
grep "nothing to commit" output
test_i18ngrep "nothing to commit" output
'
test_expect_success C_LOCALE_OUTPUT 'status with modified file in submodule' '
test_expect_success 'status with modified file in submodule' '
(cd sub && git reset --hard) &&
echo "changed" >sub/foo &&
git status >output &&
grep "modified: sub (modified content)" output
test_i18ngrep "modified: sub (modified content)" output
'
test_expect_success 'status with modified file in submodule (porcelain)' '
@ -46,10 +46,10 @@ test_expect_success 'status with modified file in submodule (porcelain)' '
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with added file in submodule' '
test_expect_success 'status with added file in submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
grep "modified: sub (modified content)" output
test_i18ngrep "modified: sub (modified content)" output
'
test_expect_success 'status with added file in submodule (porcelain)' '
@ -60,16 +60,16 @@ test_expect_success 'status with added file in submodule (porcelain)' '
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with untracked file in submodule' '
test_expect_success 'status with untracked file in submodule' '
(cd sub && git reset --hard) &&
echo "content" >sub/new-file &&
git status >output &&
grep "modified: sub (untracked content)" output
test_i18ngrep "modified: sub (untracked content)" output
'
test_expect_success C_LOCALE_OUTPUT 'status -uno with untracked file in submodule' '
test_expect_success 'status -uno with untracked file in submodule' '
git status -uno >output &&
grep "^nothing to commit" output
test_i18ngrep "^nothing to commit" output
'
test_expect_success 'status with untracked file in submodule (porcelain)' '
@ -79,11 +79,11 @@ test_expect_success 'status with untracked file in submodule (porcelain)' '
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in submodule' '
test_expect_success 'status with added and untracked file in submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
echo "content" >sub/new-file &&
git status >output &&
grep "modified: sub (modified content, untracked content)" output
test_i18ngrep "modified: sub (modified content, untracked content)" output
'
test_expect_success 'status with added and untracked file in submodule (porcelain)' '
@ -95,13 +95,13 @@ test_expect_success 'status with added and untracked file in submodule (porcelai
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with modified file in modified submodule' '
test_expect_success 'status with modified file in modified submodule' '
(cd sub && git reset --hard) &&
rm sub/new-file &&
(cd sub && echo "next change" >foo && git commit -m "next change" foo) &&
echo "changed" >sub/foo &&
git status >output &&
grep "modified: sub (new commits, modified content)" output
test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'status with modified file in modified submodule (porcelain)' '
@ -113,10 +113,10 @@ test_expect_success 'status with modified file in modified submodule (porcelain)
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule' '
test_expect_success 'status with added file in modified submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
grep "modified: sub (new commits, modified content)" output
test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'status with added file in modified submodule (porcelain)' '
@ -127,11 +127,11 @@ test_expect_success 'status with added file in modified submodule (porcelain)' '
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with untracked file in modified submodule' '
test_expect_success 'status with untracked file in modified submodule' '
(cd sub && git reset --hard) &&
echo "content" >sub/new-file &&
git status >output &&
grep "modified: sub (new commits, untracked content)" output
test_i18ngrep "modified: sub (new commits, untracked content)" output
'
test_expect_success 'status with untracked file in modified submodule (porcelain)' '
@ -141,11 +141,11 @@ test_expect_success 'status with untracked file in modified submodule (porcelain
EOF
'
test_expect_success C_LOCALE_OUTPUT 'status with added and untracked file in modified submodule' '
test_expect_success 'status with added and untracked file in modified submodule' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
echo "content" >sub/new-file &&
git status >output &&
grep "modified: sub (new commits, modified content, untracked content)" output
test_i18ngrep "modified: sub (new commits, modified content, untracked content)" output
'
test_expect_success 'status with added and untracked file in modified submodule (porcelain)' '
@ -167,24 +167,24 @@ test_expect_success 'setup .git file for sub' '
git commit -m "added .real to .gitignore" .gitignore
'
test_expect_success C_LOCALE_OUTPUT 'status with added file in modified submodule with .git file' '
test_expect_success 'status with added file in modified submodule with .git file' '
(cd sub && git reset --hard && echo >foo && git add foo) &&
git status >output &&
grep "modified: sub (new commits, modified content)" output
test_i18ngrep "modified: sub (new commits, modified content)" output
'
test_expect_success 'rm submodule contents' '
rm -rf sub/* sub/.git
'
test_expect_success C_LOCALE_OUTPUT 'status clean (empty submodule dir)' '
test_expect_success 'status clean (empty submodule dir)' '
git status >output &&
grep "nothing to commit" output
test_i18ngrep "nothing to commit" output
'
test_expect_success C_LOCALE_OUTPUT 'status -a clean (empty submodule dir)' '
test_expect_success 'status -a clean (empty submodule dir)' '
test_must_fail git commit --dry-run -a >output &&
grep "nothing to commit" output
test_i18ngrep "nothing to commit" output
'
test_done

Просмотреть файл

@ -16,7 +16,7 @@ test_expect_success 'status -h in broken repository' '
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
test_expect_code 129 git status -h >usage 2>&1
) &&
grep "[Uu]sage" broken/usage
test_i18ngrep "[Uu]sage" broken/usage
'
test_expect_success 'commit -h in broken repository' '
@ -28,7 +28,7 @@ test_expect_success 'commit -h in broken repository' '
echo "[status] showuntrackedfiles = CORRUPT" >>.git/config &&
test_expect_code 129 git commit -h >usage 2>&1
) &&
grep "[Uu]sage" broken/usage
test_i18ngrep "[Uu]sage" broken/usage
'
test_expect_success 'setup' '
@ -55,10 +55,8 @@ test_expect_success 'setup' '
git add dir2/added
'
test_expect_success C_LOCALE_OUTPUT 'status (1)' '
grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
test_expect_success 'status (1)' '
test_i18ngrep "use \"git rm --cached <file>\.\.\.\" to unstage" output
'
cat >expect <<\EOF
@ -85,11 +83,9 @@ cat >expect <<\EOF
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status (2)' '
test_expect_success 'status (2)' '
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<\EOF
@ -109,17 +105,14 @@ cat >expect <<\EOF
# untracked
EOF
git config advice.statusHints false
test_expect_success C_LOCALE_OUTPUT 'status (advice.statusHints false)' '
test_expect_success 'status (advice.statusHints false)' '
test_when_finished "git config --unset advice.statusHints" &&
git config advice.statusHints false &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
git config --unset advice.statusHints
cat >expect <<\EOF
M dir1/modified
A dir2/added
@ -178,16 +171,16 @@ cat >expect <<EOF
#
# Untracked files not listed (use -u option to show untracked files)
EOF
test_expect_success C_LOCALE_OUTPUT 'status -uno' '
test_expect_success 'status -uno' '
git status -uno >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles no)' '
test_expect_success 'status (status.showUntrackedFiles no)' '
git config status.showuntrackedfiles no
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<EOF
@ -201,9 +194,9 @@ cat >expect <<EOF
# Untracked files not listed
EOF
git config advice.statusHints false
test_expect_success C_LOCALE_OUTPUT 'status -uno (advice.statusHints false)' '
test_expect_success 'status -uno (advice.statusHints false)' '
git status -uno >output &&
test_cmp expect output
test_i18ncmp expect output
'
git config --unset advice.statusHints
@ -246,16 +239,16 @@ cat >expect <<EOF
# output
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status -unormal' '
test_expect_success 'status -unormal' '
git status -unormal >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles normal)' '
test_expect_success 'status (status.showUntrackedFiles normal)' '
git config status.showuntrackedfiles normal
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<EOF
@ -305,15 +298,16 @@ cat >expect <<EOF
# output
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status -uall' '
test_expect_success 'status -uall' '
git status -uall >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT 'status (status.showUntrackedFiles all)' '
test_expect_success 'status (status.showUntrackedFiles all)' '
git config status.showuntrackedfiles all
test_when_finished "git config --unset status.showuntrackedfiles" &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success 'teardown dir3' '
@ -367,11 +361,9 @@ cat >expect <<\EOF
# ../untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status with relative paths' '
test_expect_success 'status with relative paths' '
(cd dir1 && git status) >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<\EOF
@ -440,22 +432,18 @@ cat >expect <<\EOF
# <BLUE>untracked<RESET>
EOF
test_expect_success C_LOCALE_OUTPUT 'status with color.ui' '
test_expect_success 'status with color.ui' '
git config color.ui always &&
test_when_finished "git config --unset color.ui" &&
git status | test_decode_color >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT 'status with color.status' '
test_expect_success 'status with color.status' '
git config color.status always &&
test_when_finished "git config --unset color.status" &&
git status | test_decode_color >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<\EOF
@ -570,12 +558,12 @@ cat >expect <<\EOF
EOF
test_expect_success C_LOCALE_OUTPUT 'status without relative paths' '
test_expect_success 'status without relative paths' '
git config status.relativePaths false &&
test_when_finished "git config --unset status.relativePaths" &&
(cd dir1 && git status) >output &&
test_cmp expect output
test_i18ncmp expect output
'
@ -616,11 +604,8 @@ cat <<EOF >expect
# untracked
EOF
test_expect_success 'dry-run of partial commit excluding new file in index' '
git commit --dry-run dir1/modified >output
'
test_expect_success C_LOCALE_OUTPUT 'dry-run of partial commit excluding new file in index: output' '
test_cmp expect output
git commit --dry-run dir1/modified >output &&
test_i18ncmp expect output
'
cat >expect <<EOF
@ -667,15 +652,15 @@ cat >expect <<EOF
# output
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status submodule summary is disabled by default' '
test_expect_success 'status submodule summary is disabled by default' '
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
# we expect the same as the previous test
test_expect_success C_LOCALE_OUTPUT 'status --untracked-files=all does not show submodule' '
test_expect_success 'status --untracked-files=all does not show submodule' '
git status --untracked-files=all >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<EOF
@ -731,10 +716,10 @@ cat >expect <<EOF
# output
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'status submodule summary' '
test_expect_success 'status submodule summary' '
git config status.submodulesummary 10 &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<EOF
@ -773,15 +758,12 @@ cat >expect <<EOF
no changes added to commit (use "git add" and/or "git commit -a")
EOF
test_expect_success 'status submodule summary (clean submodule): commit' '
git commit -m "commit submodule"
'
test_expect_success C_LOCALE_OUTPUT 'status submodule summary (clean submodule): output' '
git commit -m "commit submodule" &&
git config status.submodulesummary 10 &&
test_must_fail git commit --dry-run >output &&
test_cmp expect output &&
test_i18ncmp expect output &&
git status >output &&
test_cmp expect output
test_i18ncmp expect output
'
cat >expect <<EOF
@ -827,10 +809,10 @@ cat >expect <<EOF
# output
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT 'commit --dry-run submodule summary (--amend)' '
test_expect_success 'commit --dry-run submodule summary (--amend)' '
git config status.submodulesummary 10 &&
git commit --dry-run --amend >output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
@ -882,84 +864,84 @@ cat > expect << EOF
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=untracked suppresses submodules with untracked content' '
echo modified > sm/untracked &&
git status --ignore-submodules=untracked > output &&
test_cmp expect output
test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
echo modified sm/untracked &&
git status --ignore-submodules=untracked >output &&
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=untracked suppresses submodules with untracked content' '
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
git config diff.ignoreSubmodules dirty &&
git status >output &&
test_cmp expect output &&
test_i18ncmp expect output &&
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname &&
git config --unset diff.ignoreSubmodules
'
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=untracked suppresses submodules with untracked content' '
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config --remove-section -f .gitmodules submodule.subname
'
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with untracked content' '
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
git status --ignore-submodules=dirty >output &&
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with untracked content' '
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
git config diff.ignoreSubmodules dirty &&
git status >output &&
! test -s actual &&
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname &&
git config --unset diff.ignoreSubmodules
'
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with untracked content' '
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT '--ignore-submodules=dirty suppresses submodules with modified content' '
echo modified > sm/foo &&
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
echo modified >sm/foo &&
git status --ignore-submodules=dirty >output &&
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT '.gitmodules ignore=dirty suppresses submodules with modified content' '
test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT '.git/config ignore=dirty suppresses submodules with modified content' '
test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@ -996,26 +978,26 @@ cat > expect << EOF
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
git status --ignore-submodules=untracked > output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodules with modified content" '
test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@ -1058,49 +1040,49 @@ cat > expect << EOF
# untracked
EOF
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=untracked doesn't suppress submodule summary" '
test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
git status --ignore-submodules=untracked > output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=untracked doesn't suppress submodule summary" '
test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=untracked doesn't suppress submodule summary" '
test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore untracked &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=dirty doesn't suppress submodule summary" '
test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
git status --ignore-submodules=dirty > output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_success C_LOCALE_OUTPUT ".gitmodules ignore=dirty doesn't suppress submodule summary" '
test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success C_LOCALE_OUTPUT ".git/config ignore=dirty doesn't suppress submodule summary" '
test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
git config --add -f .gitmodules submodule.subname.ignore none &&
git config --add -f .gitmodules submodule.subname.path sm &&
git config --add submodule.subname.ignore dirty &&
git config --add submodule.subname.path sm &&
git status > output &&
test_cmp expect output &&
git status >output &&
test_i18ncmp expect output &&
git config --remove-section submodule.subname &&
git config -f .gitmodules --remove-section submodule.subname
'
@ -1126,9 +1108,9 @@ cat > expect << EOF
no changes added to commit (use "git add" and/or "git commit -a")
EOF
test_expect_success C_LOCALE_OUTPUT "--ignore-submodules=all suppresses submodule summary" '
test_expect_success "--ignore-submodules=all suppresses submodule summary" '
git status --ignore-submodules=all > output &&
test_cmp expect output
test_i18ncmp expect output
'
test_expect_failure '.gitmodules ignore=all suppresses submodule summary' '

Просмотреть файл

@ -495,10 +495,10 @@ test_expect_success 'merge fast-forward in a dirty tree' '
test_debug 'git log --graph --decorate --oneline --all'
test_expect_success C_LOCALE_OUTPUT 'in-index merge' '
test_expect_success 'in-index merge' '
git reset --hard c0 &&
git merge --no-ff -s resolve c1 >out &&
grep "Wonderful." out &&
test_i18ngrep "Wonderful." out &&
verify_parents $c0 $c1
'

Просмотреть файл

@ -150,11 +150,8 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
git rm -fr . &&
git checkout --orphan new &&
cp important c0.c &&
test_must_fail git merge c0 2>out
'
test_expect_success C_LOCALE_OUTPUT 'will not overwrite untracked file on unborn branch: output' '
test_cmp out expect
test_must_fail git merge c0 2>out &&
test_i18ncmp out expect
'
test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '

Просмотреть файл

@ -46,11 +46,8 @@ test_expect_success 'setup' '
pre_merge_head="$(git rev-parse HEAD)"
test_expect_success 'fails without MERGE_HEAD (unstarted merge)' '
test_must_fail git merge --abort 2>output
'
test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (unstarted merge): fatal output' '
grep -q MERGE_HEAD output
test_must_fail git merge --abort 2>output &&
test_i18ngrep MERGE_HEAD output
'
test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' '
@ -63,11 +60,8 @@ test_expect_success 'fails without MERGE_HEAD (completed merge)' '
test ! -f .git/MERGE_HEAD &&
# Merge successfully completed
post_merge_head="$(git rev-parse HEAD)" &&
test_must_fail git merge --abort 2>output
'
test_expect_success C_LOCALE_OUTPUT 'fails without MERGE_HEAD (completed merge): output' '
grep -q MERGE_HEAD output
test_must_fail git merge --abort 2>output &&
test_i18ngrep MERGE_HEAD output
'
test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' '

Просмотреть файл

@ -61,9 +61,9 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
test_cmp empty out
'
test_expect_success C_LOCALE_OUTPUT 'git grep -O --cached' '
test_expect_success 'git grep -O --cached' '
test_must_fail git grep --cached -O GREP_PATTERN >out 2>msg &&
grep open-files-in-pager msg
test_i18ngrep open-files-in-pager msg
'
test_expect_success 'git grep -O --no-index' '

Просмотреть файл

@ -1079,6 +1079,32 @@ else
test_set_prereq C_LOCALE_OUTPUT
fi
# Use this instead of test_cmp to compare files that contain expected and
# actual output from git commands that can be translated. When running
# under GETTEXT_POISON this pretends that the command produced expected
# results.
test_i18ncmp () {
test -n "$GETTEXT_POISON" || test_cmp "$@"
}
# Use this instead of "grep expected-string actual" to see if the
# output from a git command that can be translated either contains an
# expected string, or does not contain an unwanted one. When running
# under GETTEXT_POISON this pretends that the command produced expected
# results.
test_i18ngrep () {
if test -n "$GETTEXT_POISON"
then
: # pretend success
elif test "x!" = "x$1"
then
shift
! grep "$@"
else
grep "$@"
fi
}
# test whether the filesystem supports symbolic links
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
rm -f y