]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/test-i18ngrep'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Nov 2023 02:04:02 +0000 (11:04 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Nov 2023 02:04:02 +0000 (11:04 +0900)
Another step to deprecate test_i18ngrep.

* jc/test-i18ngrep:
  tests: teach callers of test_i18ngrep to use test_grep
  test framework: further deprecate test_i18ngrep

40 files changed:
1  2 
t/t0003-attributes.sh
t/t0040-parse-options.sh
t/t0091-bugreport.sh
t/t1092-sparse-checkout-compatibility.sh
t/t1410-reflog.sh
t/t1430-bad-ref-name.sh
t/t1450-fsck.sh
t/t2004-checkout-cache-temp.sh
t/t2030-unresolve-info.sh
t/t2107-update-index-basic.sh
t/t3200-branch.sh
t/t3202-show-branch.sh
t/t3206-range-diff.sh
t/t3321-notes-stripspace.sh
t/t3400-rebase.sh
t/t3404-rebase-interactive.sh
t/t3418-rebase-continue.sh
t/t3501-revert-cherry-pick.sh
t/t3903-stash.sh
t/t4013-diff-various.sh
t/t4014-format-patch.sh
t/t4015-diff-whitespace.sh
t/t4053-diff-no-index.sh
t/t4068-diff-symmetric-merge-base.sh
t/t5318-commit-graph.sh
t/t5319-multi-pack-index.sh
t/t5324-split-commit-graph.sh
t/t5500-fetch-pack.sh
t/t5510-fetch.sh
t/t5521-pull-options.sh
t/t6433-merge-toplevel.sh
t/t6437-submodule-merge.sh
t/t6500-gc.sh
t/t7201-co.sh
t/t7508-status.sh
t/t7601-merge-pull-config.sh
t/t7810-grep.sh
t/t7900-maintenance.sh
t/t9001-send-email.sh
t/test-lib-functions.sh

Simple merge
index 06fb9e64576de8fa4c44a20cb86c4cf690569afd,c8cc0fd8d065f766106bc48c5e7297d991208f72..8fdef88b65e77bd03b9db8fc287914022ab10848
@@@ -367,41 -360,19 +367,41 @@@ test_expect_success 'OPT_NEGBIT() works
  '
  
  test_expect_success 'OPT_CMDMODE() works' '
 -      test-tool parse-options --expect="integer: 1" --mode1
 +      test-tool parse-options --expect="integer: 1" --mode1 &&
 +      test-tool parse-options --expect="integer: 3" --mode34=3
  '
  
 -test_expect_success 'OPT_CMDMODE() detects incompatibility' '
 +test_expect_success 'OPT_CMDMODE() detects incompatibility (1)' '
        test_must_fail test-tool parse-options --mode1 --mode2 >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ngrep "mode1" output.err &&
-       test_i18ngrep "mode2" output.err &&
-       test_i18ngrep "is incompatible with" output.err
 -      test_grep "incompatible with --mode" output.err
++      test_grep "mode1" output.err &&
++      test_grep "mode2" output.err &&
++      test_grep "is incompatible with" output.err
  '
  
 -test_expect_success 'OPT_CMDMODE() detects incompatibility with something else' '
 +test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
        test_must_fail test-tool parse-options --set23 --mode2 >output 2>output.err &&
        test_must_be_empty output &&
-       test_i18ngrep "mode2" output.err &&
-       test_i18ngrep "set23" output.err &&
-       test_i18ngrep "is incompatible with" output.err
 -      test_grep "incompatible with something else" output.err
++      test_grep "mode2" output.err &&
++      test_grep "set23" output.err &&
++      test_grep "is incompatible with" output.err
 +'
 +
 +test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
 +      test_must_fail test-tool parse-options --mode2 --set23 >output 2>output.err &&
 +      test_must_be_empty output &&
-       test_i18ngrep "mode2" output.err &&
-       test_i18ngrep "set23" output.err &&
-       test_i18ngrep "is incompatible with" output.err
++      test_grep "mode2" output.err &&
++      test_grep "set23" output.err &&
++      test_grep "is incompatible with" output.err
 +'
 +
 +test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
 +      test_must_fail test-tool parse-options --mode2 --mode34=3 \
 +              >output 2>output.err &&
 +      test_must_be_empty output &&
-       test_i18ngrep "mode2" output.err &&
-       test_i18ngrep "mode34.3" output.err &&
-       test_i18ngrep "is incompatible with" output.err
++      test_grep "mode2" output.err &&
++      test_grep "mode34.3" output.err &&
++      test_grep "is incompatible with" output.err
  '
  
  test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
index ae5b7dc31ffd6719226b2921d1c5f08b6f9758f6,150cc1dea24560eaa88e12abd807e947460baea6..8798feefe3f6700ee90d3854299802a60536df7d
@@@ -69,13 -69,6 +69,13 @@@ test_expect_success 'incorrect argument
        test_path_is_missing git-bugreport-*
  '
  
-       grep usage output &&
-       grep false output &&
 +test_expect_success 'incorrect positional arguments abort with usage and hint' '
 +      test_must_fail git bugreport false 2>output &&
++      test_grep usage output &&
++      test_grep false output &&
 +      test_path_is_missing git-bugreport-*
 +'
 +
  test_expect_success 'runs outside of a git dir' '
        test_when_finished rm non-repo/git-bugreport-* &&
        nongit git bugreport
Simple merge
index 7b7d6953c62d1be63c7f16e0c561b46b5e678e23,4da539cf50acac0670130d85ce2bd0a7dcc501f1..68cc9e73d0c01bb7b9642b25d33155406662116c
@@@ -217,10 -216,9 +217,10 @@@ test_expect_success 'branch -d can dele
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" &&
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
 +      test_ref_exists refs/heads/badname &&
        git branch -d badname >output 2>error &&
 -      test_path_is_missing .git/refs/heads/badname &&
 +      test_ref_missing refs/heads/badname &&
-       test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
+       test_grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
        test_must_be_empty error
  '
  
@@@ -237,10 -234,9 +237,10 @@@ test_expect_success 'update-ref --no-de
  test_expect_success 'branch -d can delete dangling symref to broken name' '
        test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref msg &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" &&
 +      test_ref_exists refs/heads/badname &&
        git branch -d badname >output 2>error &&
 -      test_path_is_missing .git/refs/heads/badname &&
 +      test_ref_missing refs/heads/badname &&
-       test_i18ngrep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
+       test_grep "Deleted branch badname (was refs/heads/broken\.\.\.ref)" output &&
        test_must_be_empty error
  '
  
@@@ -269,10 -263,9 +269,10 @@@ test_expect_success 'update-ref --no-de
  test_expect_success 'branch -d can delete symref with broken name' '
        printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
 +      test_ref_exists refs/heads/broken...symref &&
        git branch -d broken...symref >output 2>error &&
 -      test_path_is_missing .git/refs/heads/broken...symref &&
 +      test_ref_missing refs/heads/broken...symref &&
-       test_i18ngrep "Deleted branch broken...symref (was refs/heads/main)" output &&
+       test_grep "Deleted branch broken...symref (was refs/heads/main)" output &&
        test_must_be_empty error
  '
  
@@@ -289,10 -281,9 +289,10 @@@ test_expect_success 'update-ref --no-de
  test_expect_success 'branch -d can delete dangling symref with broken name' '
        printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref &&
        test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" &&
 +      test_ref_exists refs/heads/broken...symref &&
        git branch -d broken...symref >output 2>error &&
 -      test_path_is_missing .git/refs/heads/broken...symref &&
 +      test_ref_missing refs/heads/broken...symref &&
-       test_i18ngrep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
+       test_grep "Deleted branch broken...symref (was refs/heads/idonotexist)" output &&
        test_must_be_empty error
  '
  
diff --cc t/t1450-fsck.sh
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 2cdb834b37e65bdc0d1bf74109def557dc3bb675,235c68fb022c43f99dd838b36dac6f882ba655d2..6a98b2df7611ed741be197640f20e1147794aa8d
@@@ -253,7 -253,7 +253,7 @@@ test_expect_success 'error description
        test_branch_op_in_wt() {
                test_orphan_error() {
                        test_must_fail git $* 2>actual &&
-                       test_i18ngrep "no commit on branch .orphan-branch. yet$" actual
 -                      test_grep "No commit on branch .orphan-branch. yet.$" actual
++                      test_grep "no commit on branch .orphan-branch. yet$" actual
                } &&
                test_orphan_error -C wt branch $1 $2 &&                # implicit branch
                test_orphan_error -C wt branch $1 orphan-branch $2 &&  # explicit branch
Simple merge
Simple merge
index d3df19a51f83a9193916c3812d1ca152644b470f,621c8ef84c8acc29e4a7ff8adbdf467a66b9e237..24a539c662f6c1f941e4f8c2949cfdc07d3cf2e5
@@@ -421,7 -421,7 +421,7 @@@ test_expect_success 'refuse to switch t
        git checkout main &&
        git worktree add wt &&
        test_must_fail git -C wt rebase main main 2>err &&
-       test_i18ngrep "already used by worktree at" err
 -      test_grep "already checked out" err
++      test_grep "already used by worktree at" err
  '
  
  test_expect_success MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' '
index 8ea2bf13026c1c29d04bfdc715c0901b0c062cf6,dbd5df5aa469ada4da859fed5651f7b03f4171f3..c5f30554c6f356742732f8979a55c872441fb159
@@@ -604,8 -604,7 +604,8 @@@ test_expect_success 'clean error after 
        echo "edited again" > file7 &&
        git add file7 &&
        test_must_fail git rebase --continue 2>error &&
-       test_i18ngrep "you have staged changes in your working tree" error &&
-       test_i18ngrep ! "could not open.*for reading" error
 -      test_grep "you have staged changes in your working tree" error
++      test_grep "you have staged changes in your working tree" error &&
++      test_grep ! "could not open.*for reading" error
  '
  
  test_expect_success 'rebase a detached HEAD' '
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 541642650f533816ae8ea6490141893cbc111ce4,3356d91cd4a0d595e8d8e126b71902d3e06e7427..eff63c16b064d124b59a2e4b310e3ce5e190c532
@@@ -150,7 -143,7 +150,7 @@@ d
        test_expect_success "$cmd --merge-base with non-commit" '
                git checkout main &&
                test_must_fail git $cmd --merge-base main^{tree} 2>err &&
-               test_i18ngrep "is a tree, not a commit" err
 -              test_grep "fatal: --merge-base only works with commits" err
++              test_grep "is a tree, not a commit" err
        '
  
        test_expect_success "$cmd --merge-base with no merge bases and one commit" '
@@@ -176,7 -169,7 +176,7 @@@ d
  
        test_expect_success "$cmd --merge-base commit and non-commit" '
                test_must_fail git $cmd --merge-base br2 main^{tree} 2>err &&
-               test_i18ngrep "is a tree, not a commit" err
 -              test_grep "fatal: --merge-base only works with commits" err
++              test_grep "is a tree, not a commit" err
        '
  
        test_expect_success "$cmd --merge-base with no merge bases and two commits" '
Simple merge
Simple merge
index 97eb6d2e72bac5c3936965c269ff9bfa56d87568,a48c00ef50429f546ad72b6b74bc015d9143b491..281266f7883b35cbc4dd2c631d645d0d5b430d0c
@@@ -335,54 -306,27 +335,54 @@@ test_expect_success 'warn on base grap
                git commit-graph verify &&
                base_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
                corrupt_file "$base_file" $(test_oid base) "\01" &&
 -              git commit-graph verify --shallow 2>test_err &&
 +              test_must_fail git commit-graph verify --shallow 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "commit-graph chain does not match" err
+               test_grep "commit-graph chain does not match" err
        )
  '
  
 -test_expect_success 'verify after commit-graph-chain corruption' '
 -      git clone --no-hardlinks . verify-chain &&
 +test_expect_success 'verify after commit-graph-chain corruption (base)' '
 +      git clone --no-hardlinks . verify-chain-base &&
        (
 -              cd verify-chain &&
 -              corrupt_file "$graphdir/commit-graph-chain" 60 "G" &&
 -              git commit-graph verify 2>test_err &&
 +              cd verify-chain-base &&
 +              corrupt_file "$graphdir/commit-graph-chain" 30 "G" &&
 +              test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "invalid commit-graph chain" err &&
+               test_grep "invalid commit-graph chain" err &&
 -              corrupt_file "$graphdir/commit-graph-chain" 60 "A" &&
 -              git commit-graph verify 2>test_err &&
 +              corrupt_file "$graphdir/commit-graph-chain" 30 "A" &&
 +              test_must_fail git commit-graph verify 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "unable to find all commit-graph files" err
+               test_grep "unable to find all commit-graph files" err
        )
  '
  
-               test_i18ngrep "invalid commit-graph chain" err &&
 +test_expect_success 'verify after commit-graph-chain corruption (tip)' '
 +      git clone --no-hardlinks . verify-chain-tip &&
 +      (
 +              cd verify-chain-tip &&
 +              corrupt_file "$graphdir/commit-graph-chain" 70 "G" &&
 +              test_must_fail git commit-graph verify 2>test_err &&
 +              grep -v "^+" test_err >err &&
-               test_i18ngrep "unable to find all commit-graph files" err
++              test_grep "invalid commit-graph chain" err &&
 +              corrupt_file "$graphdir/commit-graph-chain" 70 "A" &&
 +              test_must_fail git commit-graph verify 2>test_err &&
 +              grep -v "^+" test_err >err &&
++              test_grep "unable to find all commit-graph files" err
 +      )
 +'
 +
 +test_expect_success 'verify notices too-short chain file' '
 +      git clone --no-hardlinks . verify-chain-short &&
 +      (
 +              cd verify-chain-short &&
 +              git commit-graph verify &&
 +              echo "garbage" >$graphdir/commit-graph-chain &&
 +              test_must_fail git commit-graph verify 2>test_err &&
 +              grep -v "^+" test_err >err &&
 +              grep "commit-graph chain file too small" err
 +      )
 +'
 +
  test_expect_success 'verify across alternates' '
        git clone --no-hardlinks . verify-alt &&
        (
                test_commit extra &&
                git commit-graph write --reachable --split &&
                tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
 -              corrupt_file "$tip_file" 100 "\01" &&
 +              corrupt_file "$tip_file" 1500 "\01" &&
                test_must_fail git commit-graph verify --shallow 2>test_err &&
                grep -v "^+" test_err >err &&
-               test_i18ngrep "incorrect checksum" err
 -              test_grep "commit-graph has incorrect fanout value" err
++              test_grep "incorrect checksum" err
 +      )
 +'
 +
 +test_expect_success 'reader bounds-checks base-graph chunk' '
 +      git clone --no-hardlinks . corrupt-base-chunk &&
 +      (
 +              cd corrupt-base-chunk &&
 +              tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph &&
 +              corrupt_chunk_file "$tip_file" BASE clear 01020304 &&
 +              git -c core.commitGraph=false log >expect.out &&
 +              git -c core.commitGraph=true log >out 2>err &&
 +              test_cmp expect.out out &&
 +              grep "commit-graph base graphs chunk is too small" err
        )
  '
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc t/t6500-gc.sh
Simple merge
diff --cc t/t7201-co.sh
Simple merge
Simple merge
Simple merge
diff --cc t/t7810-grep.sh
Simple merge
Simple merge
Simple merge
Simple merge