Skip to content

Commit

Permalink
tests with git#17 test_i18ngrep: replace it with 'grep'
Browse files Browse the repository at this point in the history
For those tests that have 17 occurances of 'test_i18ngrep', replace it
with 'grep'. Splitting this incremental conversion by number of
occurances in the file is arbitrary, but help so keep the commit size
down.

The 'test_i18ngrep' wrapper has been deprecated since
d162b25 (tests: remove support for GIT_TEST_GETTEXT_POISON,
2021-01-20).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  • Loading branch information
avar committed Feb 1, 2023
1 parent 78a371e commit 9351edd
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 68 deletions.
34 changes: 17 additions & 17 deletions t/t1506-rev-parse-diagnosis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,26 @@ test_expect_success 'correct relative file objects (6)' '

test_expect_success 'incorrect revision id' '
test_must_fail git rev-parse foobar:file.txt 2>error &&
test_i18ngrep "invalid object name .foobar." error &&
grep "invalid object name .foobar." error &&
test_must_fail git rev-parse foobar 2>error &&
test_i18ngrep "unknown revision or path not in the working tree." error
grep "unknown revision or path not in the working tree." error
'

test_expect_success 'incorrect file in sha1:path' '
test_must_fail git rev-parse HEAD:nothing.txt 2>error &&
test_i18ngrep "path .nothing.txt. does not exist in .HEAD." error &&
grep "path .nothing.txt. does not exist in .HEAD." error &&
test_must_fail git rev-parse HEAD:index-only.txt 2>error &&
test_i18ngrep "path .index-only.txt. exists on disk, but not in .HEAD." error &&
grep "path .index-only.txt. exists on disk, but not in .HEAD." error &&
(cd subdir &&
test_must_fail git rev-parse HEAD:file2.txt 2>error &&
test_did_you_mean HEAD subdir/ file2.txt exists )
'

test_expect_success 'incorrect file in :path and :N:path' '
test_must_fail git rev-parse :nothing.txt 2>error &&
test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
grep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
test_must_fail git rev-parse :1:nothing.txt 2>error &&
test_i18ngrep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
grep "path .nothing.txt. does not exist (neither on disk nor in the index)" error &&
test_must_fail git rev-parse :1:file.txt 2>error &&
test_did_you_mean ":0" "" file.txt "is in the index" "at stage 1" &&
(cd subdir &&
Expand All @@ -137,42 +137,42 @@ test_expect_success 'incorrect file in :path and :N:path' '
test_must_fail git rev-parse :2:file2.txt 2>error &&
test_did_you_mean :0 subdir/ file2.txt "is in the index") &&
test_must_fail git rev-parse :disk-only.txt 2>error &&
test_i18ngrep "path .disk-only.txt. exists on disk, but not in the index" error
grep "path .disk-only.txt. exists on disk, but not in the index" error
'

test_expect_success 'invalid @{n} reference' '
test_must_fail git rev-parse main@{99999} >output 2>error &&
test_must_be_empty output &&
test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error &&
grep "log for [^ ]* only has [0-9][0-9]* entries" error &&
test_must_fail git rev-parse --verify main@{99999} >output 2>error &&
test_must_be_empty output &&
test_i18ngrep "log for [^ ]* only has [0-9][0-9]* entries" error
grep "log for [^ ]* only has [0-9][0-9]* entries" error
'

test_expect_success 'relative path not found' '
(
cd subdir &&
test_must_fail git rev-parse HEAD:./nonexistent.txt 2>error &&
test_i18ngrep subdir/nonexistent.txt error
grep subdir/nonexistent.txt error
)
'

test_expect_success 'relative path outside worktree' '
test_must_fail git rev-parse HEAD:../file.txt >output 2>error &&
test_must_be_empty output &&
test_i18ngrep "outside repository" error
grep "outside repository" error
'

test_expect_success 'relative path when cwd is outside worktree' '
test_must_fail git --git-dir=.git --work-tree=subdir rev-parse HEAD:./file.txt >output 2>error &&
test_must_be_empty output &&
test_i18ngrep "relative path syntax can.t be used outside working tree" error
grep "relative path syntax can.t be used outside working tree" error
'

test_expect_success '<commit>:file correctly diagnosed after a pathname' '
test_must_fail git rev-parse file.txt HEAD:file.txt 1>actual 2>error &&
test_i18ngrep ! "exists on disk" error &&
test_i18ngrep "no such path in the working tree" error &&
! grep "exists on disk" error &&
grep "no such path in the working tree" error &&
cat >expect <<-\EOF &&
file.txt
HEAD:file.txt
Expand Down Expand Up @@ -214,13 +214,13 @@ test_expect_success 'dotdot does not peel endpoints' '

test_expect_success 'arg before dashdash must be a revision (missing)' '
test_must_fail git rev-parse foobar -- 2>stderr &&
test_i18ngrep "bad revision" stderr
grep "bad revision" stderr
'

test_expect_success 'arg before dashdash must be a revision (file)' '
>foobar &&
test_must_fail git rev-parse foobar -- 2>stderr &&
test_i18ngrep "bad revision" stderr
grep "bad revision" stderr
'

test_expect_success 'arg before dashdash must be a revision (ambiguous)' '
Expand Down Expand Up @@ -269,7 +269,7 @@ test_expect_success 'arg after dashdash not interpreted as option' '

test_expect_success 'arg after end-of-options not interpreted as option' '
test_must_fail git rev-parse --end-of-options --not-real -- 2>err &&
test_i18ngrep bad.revision.*--not-real err
grep bad.revision.*--not-real err
'

test_expect_success 'end-of-options still allows --' '
Expand Down
34 changes: 17 additions & 17 deletions t/t4001-diff-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ test_expect_success 'favour same basenames over different ones' '
mkdir subdir &&
git mv another-path subdir/path1 &&
git status >out &&
test_i18ngrep "renamed: .*path1 -> subdir/path1" out
grep "renamed: .*path1 -> subdir/path1" out
'

test_expect_success 'test diff.renames=true for git status' '
git -c diff.renames=true status >out &&
test_i18ngrep "renamed: .*path1 -> subdir/path1" out
grep "renamed: .*path1 -> subdir/path1" out
'

test_expect_success 'test diff.renames=false for git status' '
git -c diff.renames=false status >out &&
test_i18ngrep ! "renamed: .*path1 -> subdir/path1" out &&
test_i18ngrep "new file: .*subdir/path1" out &&
test_i18ngrep "deleted: .*[^/]path1" out
! grep "renamed: .*path1 -> subdir/path1" out &&
grep "new file: .*subdir/path1" out &&
grep "deleted: .*[^/]path1" out
'

test_expect_success 'favour same basenames even with minor differences' '
git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
git status >out &&
test_i18ngrep "renamed: .*path1 -> subdir/path1" out
grep "renamed: .*path1 -> subdir/path1" out
'

test_expect_success 'two files with same basename and same content' '
Expand All @@ -165,7 +165,7 @@ test_expect_success 'two files with same basename and same content' '
git commit -m 2 &&
git mv dir other-dir &&
git status >out &&
test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
grep "renamed: .*dir/A/file -> other-dir/A/file" out
'

test_expect_success 'setup for many rename source candidates' '
Expand Down Expand Up @@ -202,49 +202,49 @@ test_expect_success 'rename pretty print with nothing in common' '
git mv a/b/c c/b/a &&
git commit -m "a/b/c -> c/b/a" &&
git diff -M --summary HEAD^ HEAD >output &&
test_i18ngrep " a/b/c => c/b/a " output &&
grep " a/b/c => c/b/a " output &&
git diff -M --stat HEAD^ HEAD >output &&
test_i18ngrep " a/b/c => c/b/a " output
grep " a/b/c => c/b/a " output
'

test_expect_success 'rename pretty print with common prefix' '
mkdir -p c/d &&
git mv c/b/a c/d/e &&
git commit -m "c/b/a -> c/d/e" &&
git diff -M --summary HEAD^ HEAD >output &&
test_i18ngrep " c/{b/a => d/e} " output &&
grep " c/{b/a => d/e} " output &&
git diff -M --stat HEAD^ HEAD >output &&
test_i18ngrep " c/{b/a => d/e} " output
grep " c/{b/a => d/e} " output
'

test_expect_success 'rename pretty print with common suffix' '
mkdir d &&
git mv c/d/e d/e &&
git commit -m "c/d/e -> d/e" &&
git diff -M --summary HEAD^ HEAD >output &&
test_i18ngrep " {c/d => d}/e " output &&
grep " {c/d => d}/e " output &&
git diff -M --stat HEAD^ HEAD >output &&
test_i18ngrep " {c/d => d}/e " output
grep " {c/d => d}/e " output
'

test_expect_success 'rename pretty print with common prefix and suffix' '
mkdir d/f &&
git mv d/e d/f/e &&
git commit -m "d/e -> d/f/e" &&
git diff -M --summary HEAD^ HEAD >output &&
test_i18ngrep " d/{ => f}/e " output &&
grep " d/{ => f}/e " output &&
git diff -M --stat HEAD^ HEAD >output &&
test_i18ngrep " d/{ => f}/e " output
grep " d/{ => f}/e " output
'

test_expect_success 'rename pretty print common prefix and suffix overlap' '
mkdir d/f/f &&
git mv d/f/e d/f/f/e &&
git commit -m "d/f/e d/f/f/e" &&
git diff -M --summary HEAD^ HEAD >output &&
test_i18ngrep " d/f/{ => f}/e " output &&
grep " d/f/{ => f}/e " output &&
git diff -M --stat HEAD^ HEAD >output &&
test_i18ngrep " d/f/{ => f}/e " output
grep " d/f/{ => f}/e " output
'

test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
Expand Down
34 changes: 17 additions & 17 deletions t/t5520-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test_pull_autostash_fail () {
echo dirty >new_file &&
git add new_file &&
test_must_fail git pull "$@" . copy 2>err &&
test_i18ngrep -E "uncommitted changes.|overwritten by merge:" err
grep -E "uncommitted changes.|overwritten by merge:" err
}

test_expect_success setup '
Expand Down Expand Up @@ -151,7 +151,7 @@ test_expect_success 'fail if wildcard spec does not match any refs' '
echo file >expect &&
test_cmp expect file &&
test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err &&
test_i18ngrep "no candidates for merging" err &&
grep "no candidates for merging" err &&
test_cmp expect file
'

Expand All @@ -164,7 +164,7 @@ test_expect_success 'fail if no branches specified with non-default remote' '
test_cmp expect file &&
test_config branch.test.remote origin &&
test_must_fail git pull test_remote 2>err &&
test_i18ngrep "specify a branch on the command line" err &&
grep "specify a branch on the command line" err &&
test_cmp expect file
'

Expand All @@ -176,7 +176,7 @@ test_expect_success 'fail if not on a branch' '
echo file >expect &&
test_cmp expect file &&
test_must_fail git pull 2>err &&
test_i18ngrep "not currently on a branch" err &&
grep "not currently on a branch" err &&
test_cmp expect file
'

Expand All @@ -189,7 +189,7 @@ test_expect_success 'fail if no configuration for current branch' '
echo file >expect &&
test_cmp expect file &&
test_must_fail git pull 2>err &&
test_i18ngrep "no tracking information" err &&
grep "no tracking information" err &&
test_cmp expect file
'

Expand All @@ -202,7 +202,7 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '
echo file >expect &&
test_cmp expect file &&
test_must_fail git pull --all 2>err &&
test_i18ngrep "There is no tracking information" err &&
grep "There is no tracking information" err &&
test_cmp expect file
'

Expand All @@ -214,7 +214,7 @@ test_expect_success 'fail if upstream branch does not exist' '
echo file >expect &&
test_cmp expect file &&
test_must_fail git pull 2>err &&
test_i18ngrep "no such ref was fetched" err &&
grep "no such ref was fetched" err &&
test_cmp expect file
'

Expand Down Expand Up @@ -248,13 +248,13 @@ test_expect_success 'fail if the index has unresolved entries' '
test_file_not_empty unmerged &&
cp file expected &&
test_must_fail git pull . second 2>err &&
test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
grep "Pulling is not possible because you have unmerged files." err &&
test_cmp expected file &&
git add file &&
git ls-files -u >unmerged &&
test_must_be_empty unmerged &&
test_must_fail git pull . second 2>err &&
test_i18ngrep "You have not concluded your merge" err &&
grep "You have not concluded your merge" err &&
test_cmp expected file
'

Expand All @@ -264,7 +264,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' '
echo file >expect &&
test_cmp expect file &&
git pull . second:third 2>err &&
test_i18ngrep "fetch updated the current branch head" err &&
grep "fetch updated the current branch head" err &&
echo modified >expect &&
test_cmp expect file &&
test_cmp_rev third second
Expand All @@ -277,7 +277,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' '
test_cmp expect file &&
echo conflict >file &&
test_must_fail git pull . second:third 2>err &&
test_i18ngrep "Cannot fast-forward your working tree" err &&
grep "Cannot fast-forward your working tree" err &&
echo conflict >expect &&
test_cmp expect file &&
test_cmp_rev third second
Expand Down Expand Up @@ -375,7 +375,7 @@ test_expect_success '--rebase with conflicts shows advice' '
test_tick &&
git commit -m "Create conflict" seq.txt &&
test_must_fail git pull --rebase . seq 2>err >out &&
test_i18ngrep "Resolve all conflicts manually" err
grep "Resolve all conflicts manually" err
'

test_expect_success 'failed --rebase shows advice' '
Expand All @@ -389,14 +389,14 @@ test_expect_success 'failed --rebase shows advice' '
git checkout -f -b fails-to-rebase HEAD^ &&
test_commit v2-without-cr file "2" file2-lf &&
test_must_fail git pull --rebase . diverging 2>err >out &&
test_i18ngrep "Resolve all conflicts manually" err
grep "Resolve all conflicts manually" err
'

test_expect_success '--rebase fails with multiple branches' '
git reset --hard before-rebase &&
test_must_fail git pull --rebase . copy main 2>err &&
test_cmp_rev HEAD before-rebase &&
test_i18ngrep "Cannot rebase onto multiple branches" err &&
grep "Cannot rebase onto multiple branches" err &&
echo modified >expect &&
git show HEAD:file >actual &&
test_cmp expect actual
Expand Down Expand Up @@ -520,7 +520,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' '
echo new >expect &&
git show HEAD:file2 >actual &&
test_cmp expect actual &&
test_i18ngrep "ignoring --verify-signatures for rebase" err
grep "ignoring --verify-signatures for rebase" err
'

test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
Expand All @@ -530,7 +530,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
echo new >expect &&
git show HEAD:file2 >actual &&
test_cmp expect actual &&
test_i18ngrep ! "verify-signatures" err
! grep "verify-signatures" err
'

# add a feature branch, keep-merge, that is merged into main, so the
Expand Down Expand Up @@ -740,7 +740,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
test_cmp expect actual &&
git show :staged-file >actual &&
test_cmp expect actual &&
test_i18ngrep "unborn branch with changes added to the index" err
grep "unborn branch with changes added to the index" err
)
'

Expand Down
Loading

0 comments on commit 9351edd

Please sign in to comment.