git bugreport with invalid CLI argument does not report error
Hi Maintainers,
Running git bugreport with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.
#Example git commands which should have reported an error but continues to succeed
cd $ToAnyDirectory
git bugreport diagnose
Thanks
Sheik
[System Info]
git version:
git version 2.42.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.5.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1 (2023-10-07) x86_64 compiler info: gnuc: 13.2
libc info: glibc: 2.37
$SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks]
Quoted 8 lines · Sheik
Hi Maintainers,
Running git bugreport with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.
Quoted 6 lines
#Example git commands which should have reported an error but continues to succeed
cd $ToAnyDirectory
git bugreport diagnose
It looks like parse-options.[ch] helps us here for misspelled dashed options, like --diaggnose. But it doesn't complain when there are unexpected positional arguments. I think we can just notice if there are any argc left over, complain, and print usage.
I put together a quick patch; could be that we don't need to leave this error about "positional arguments" and can leave it as an exercise to the reader to compare their previous command to the usage text. I guess we could also unroll remaining argv but it was just a hair more time than I wanted to spend ;)
- Emily
--- 8< ---
From 2031c7f55652559b8b4ec3c67ce4c4f94a355762 Mon Sep 17 00:00:00 2001
From: Emily Shaffer <[email protected]>
Date: Wed, 25 Oct 2023 15:45:25 -0700
Subject: [PATCH] bugreport: reject positional arguments
git-bugreport already rejected unrecognized flag arguments, like --diaggnose, but this doesn't help if the user's mistake was to forget the -- in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.
--- builtin/bugreport.c | 5 +++++ t/t0091-bugreport.sh | 6 ++++++ 2 files changed, 11 insertions(+)
builtin/bugreport.c +5 -0
@@ -126,6 +126,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) argc =parse_options (argc, argv, prefix, bugreport_options, bugreport_usage,0 ); +if (argc) { +error (_ ("git bugreport does not take positional arguments" )); +usage (bugreport_usage[0 ]); + } +/* Prepare the path to put the result */ prefixed_filename =prefix_filename (prefix, option_output ? option_output :"" );
t/t0091-bugreport.sh +6 -0
@@ -69,6 +69,12 @@ test_expect_success 'incorrect arguments abort with usage' ' test_path_is_missing git-bugreport-* ' +test_expect_success 'incorrect positional arguments abort with usage' ' + test_must_fail git bugreport false 2>output && + test_i18ngrep usage 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
Signature · 1 line
2.42.0.758.gaed0368e0e-goog
Quoted 29 lines · Emily Shaffer
Quoted 2 lines · Sheik
Running git bugreport with an invalid CLI argument in a valid Git directory does not report error. Expected behaviour would be that it reports an error.
It looks like parse-options.[ch] helps us here for misspelled dashed options, like
--diaggnose. But it doesn't complain when there are unexpected positional arguments. I think we can just notice if there are any argc left over, complain, and print usage.I put together a quick patch; could be that we don't need to leave this error about "positional arguments" and can leave it as an exercise to the reader to compare their previous command to the usage text. I guess we could also unroll remaining argv but it was just a hair more time than I wanted to spend ;)
--- 8< ---
Subject: [PATCH] bugreport: reject positional argumentsgit-bugreport already rejected unrecognized flag arguments, like
--diaggnose, but this doesn't help if the user's mistake was to forget the--in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.Signed-off-by Emily Shaffer <[email protected]>---
builtin/bugreport.c int cmd_bugreport(int argc, const char **argv, const char *prefix) · line 129
Quoted 4 lines
builtin/bugreport.c +4
-0@@ -126,6 +126,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) +if (argc) { +error (_ ("git bugreport does not take positional arguments" )); +usage (bugreport_usage[0 ]); + }
This error message may be somewhat difficult to interpret. Providing additional context could help the user understand the actual problem. For instance:
% git bugreport diagnose
error: unrecognized argument "diagnose"
PATCH v2 1/1 bugreport: reject positional arguments
From: Emily Shaffer <[email protected]>
git-bugreport already rejected unrecognized flag arguments, like --diaggnose, but this doesn't help if the user's mistake was to forget the -- in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.
---
Per Eric's suggestion, added a citation of the first positional arg found. I don't think it's necessary to unroll the entire argv array here, though.
- Emily
builtin/bugreport.c | 6 ++++++ t/t0091-bugreport.sh | 7 +++++++ 2 files changed, 13 insertions(+)
builtin/bugreport.c +6 -0
@@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) argc =parse_options (argc, argv, prefix, bugreport_options, bugreport_usage,0 ); +if (argc) { +if (argv[0 ]) +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + } +/* Prepare the path to put the result */ prefixed_filename =prefix_filename (prefix, option_output ? option_output :"" );
t/t0091-bugreport.sh +7 -0
@@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' ' test_path_is_missing git-bugreport-* ' +test_expect_success 'incorrect positional arguments abort with usage and hint' ' + test_must_fail git bugreport false 2>output && + test_i18ngrep usage output && + test_i18ngrep 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
Signature · 1 line
2.42.0.758.gaed0368e0e-goog
Re: [PATCH v2] bugreport: reject positional arguments
Quoted 7 lines · On Wed, Oct 25, 2023 at 8:55 PM <[email protected]> wrote:
git-bugreport already rejected unrecognized flag arguments, like
--diaggnose, but this doesn't help if the user's mistake was to forget the--in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.
Quoted 5 lines
Signed-off-by Emily Shaffer <[email protected]>---
Per Eric's suggestion, added a citation of the first positional arg found. I don't think it's necessary to unroll the entire argv array here, though.
Thanks. I had the same thought about the first positional argument being sufficient since it should provide enough context on its own.
builtin/bugreport.c int cmd_bugreport(int argc, const char **argv, const char *prefix) · line 130
Quoted 7 lines
builtin/bugreport.c +5
-0@@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) +if (argc) { +if (argv[0 ]) +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + }
Can it actually happen that argc is non-zero but argv[0] is NULL? (I don't have parse-options in front of me to check.) If not, then the extra if (argv[0]) conditional may confuse future readers.
Re: [PATCH v2] bugreport: reject positional arguments
Quoted 13 lines · Eric Sunshine
builtin/bugreport.c int cmd_bugreport(int argc, const char **argv, · line 131
Quoted 8 lines · On Wed, Oct 25, 2023 at 8:55 PM <[email protected]> wrote:
builtin/bugreport.c +5
-0@@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) + if (argc) { +if (argv[0 ]) +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + }Can it actually happen that argc is non-zero but argv[0] is NULL? (I don't have parse-options in front of me to check.) If not, then the extra
if (argv[0])conditional may confuse future readers.
According to https://stackoverflow.com/a/2794171/22330192 it can't, but argv[0] can be a zero-length string.
Re: [PATCH v2] bugreport: reject positional arguments
Quoted 15 lines · Dragan Simic
Quoted 13 lines · Eric Sunshine
builtin/bugreport.c int cmd_bugreport(int argc, const char **argv, · line 131
Quoted 8 lines · On Wed, Oct 25, 2023 at 8:55 PM <[email protected]> wrote:
builtin/bugreport.c +5
-0@@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) + if (argc) { +if (argv[0 ]) +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + }Can it actually happen that argc is non-zero but argv[0] is NULL? (I don't have parse-options in front of me to check.) If not, then the extra
if (argv[0])conditional may confuse future readers.
Quoted 2 lines
According to https://stackoverflow.com/a/2794171/22330192 it can't, but argv[0] can be a zero-length string.
This case is different, though, since, by this point, argv[] has been processed by Git's parse-options API. Here's the relevant comment from parse-options.h:
* parse_options() will filter out the processed options and leave the
* non-option arguments in argv[]. argv0 is assumed program name and
* skipped.
*
* Returns the number of arguments left in argv[].
So, I think the if (argv[0]) conditional is unnecessary, thus potentially confusing.
It's possible that Emily meant if (*argv[0]), but even that seems undesirable since even a zero-length argv[0] provides some useful context.
% git bugreport ""
error: unknown argument `'
Re: [PATCH v2] bugreport: reject positional arguments
Quoted 16 lines · Eric Sunshine
Quoted 15 lines · Dragan Simic
Quoted 13 lines · Eric Sunshine
builtin/bugreport.c int cmd_bugreport(int argc, const char **argv, · line 131
Quoted 8 lines · On Wed, Oct 25, 2023 at 8:55 PM <[email protected]> wrote:
builtin/bugreport.c +5
-0@@ -126,6 +126,12 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) + if (argc) { +if (argv[0 ]) +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + }Can it actually happen that argc is non-zero but argv[0] is NULL? (I don't have parse-options in front of me to check.) If not, then the extra
if (argv[0])conditional may confuse future readers.
Quoted 6 lines
Quoted 2 lines
According to https://stackoverflow.com/a/2794171/22330192 it can't, but argv[0] can be a zero-length string.
This case is different, though, since, by this point, argv[] has been processed by Git's parse-options API. Here's the relevant comment from
parse-options.h:
Ah, I see, thanks for the clarification.
Quoted 16 lines
*
parse_options()will filter out the processed options and leave
the
* non-option arguments in argv[]. argv0 is assumed program name and
* skipped.
*
* Returns the number of arguments left in argv[].So, I think the
if (argv[0])conditional is unnecessary, thus potentially confusing.It's possible that Emily meant
if (*argv[0]), but even that seems undesirable since even a zero-length argv[0] provides some useful context.% git bugreport ""
error: unknown argument `'
PATCH v3 1/1 bugreport: reject positional arguments
In reply to [email protected]From: Emily Shaffer <[email protected]>
git-bugreport already rejected unrecognized flag arguments, like --diaggnose, but this doesn't help if the user's mistake was to forget the -- in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.
---
Per Eric's and Dragan's comments, dropped the null checking for argv[0]. No point in being too paranoid, I suppose :)
Note that after this morning it's not likely that I'll be able to find time to update this again so quickly, so if there are other nits, reviewers can feel free to send their own rerolls rather than waiting for me to see it and turn the patch around.
- Emily
builtin/bugreport.c | 5 +++++ t/t0091-bugreport.sh | 7 +++++++ 2 files changed, 12 insertions(+)
builtin/bugreport.c +5 -0
@@ -126,6 +126,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) argc =parse_options (argc, argv, prefix, bugreport_options, bugreport_usage,0 ); +if (argc) { +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + } +/* Prepare the path to put the result */ prefixed_filename =prefix_filename (prefix, option_output ? option_output :"" );
t/t0091-bugreport.sh +7 -0
@@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' ' test_path_is_missing git-bugreport-* ' +test_expect_success 'incorrect positional arguments abort with usage and hint' ' + test_must_fail git bugreport false 2>output && + test_i18ngrep usage output && + test_i18ngrep 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
Signature · 1 line
2.42.0.758.gaed0368e0e-goog
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 8 lines · On Thu, Oct 26, 2023 at 11:55 AM <[email protected]> wrote:
git-bugreport already rejected unrecognized flag arguments, like
--diaggnose, but this doesn't help if the user's mistake was to forget the--in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.Signed-off-by Emily Shaffer <[email protected]>
Quoted 8 lines
---
Per Eric's and Dragan's comments, dropped the null checking for argv[0]. No point in being too paranoid, I suppose :)Note that after this morning it's not likely that I'll be able to find time to update this again so quickly, so if there are other nits, reviewers can feel free to send their own rerolls rather than waiting for me to see it and turn the patch around.
Thanks. This version looks good enough to me. Just one minor comment below...
t/t0091-bugreport.sh test_expect_success 'incorrect arguments abort with usage' ' · line 74
Quoted 8 lines
t/t0091-bugreport.sh +6
-0@@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' ' +test_expect_success 'incorrect positional arguments abort with usage and hint' ' + test_must_fail git bugreport false 2>output && + test_i18ngrep usage output && + test_i18ngrep false output && + test_path_is_missing git-bugreport-* +'
I didn't really pay attention to the test in earlier rounds so didn't notice this, but these days we just use 'grep' rather than 'test_i18ngrep'. (Indeed, the existing tests in this script use 'grep'.)
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 20 lines · Eric Sunshine
Quoted 8 lines · On Thu, Oct 26, 2023 at 11:55 AM <[email protected]> wrote:
git-bugreport already rejected unrecognized flag arguments, like
--diaggnose, but this doesn't help if the user's mistake was to forget the--in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.Signed-off-by Emily Shaffer <[email protected]>Quoted 8 lines
---
Per Eric's and Dragan's comments, dropped the null checking for argv[0]. No point in being too paranoid, I suppose :)Note that after this morning it's not likely that I'll be able to find time to update this again so quickly, so if there are other nits, reviewers can feel free to send their own rerolls rather than waiting for me to see it and turn the patch around.
Thanks. This version looks good enough to me. Just one minor comment below...
Quoted 13 lines
t/t0091-bugreport.sh test_expect_success 'incorrect arguments abort with usage' ' · line 74
Quoted 8 lines
t/t0091-bugreport.sh +6
-0@@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' ' +test_expect_success 'incorrect positional arguments abort with usage and hint' ' + test_must_fail git bugreport false 2>output && + test_i18ngrep usage output && + test_i18ngrep false output && + test_path_is_missing git-bugreport-* +'I didn't really pay attention to the test in earlier rounds so didn't notice this, but these days we just use 'grep' rather than '
test_i18ngrep'. (Indeed, the existing tests in this script use 'grep'.)
It is rather unfortunate that test_i18ngrep was deprecated without providing an alternative that offers the same debugging experience. When test_i18ngrep fails it prints a message with the pattern and text that failed to match so it is easy to see where the test failed. If grep fails there is no output and so unless the test is run with "-x" it can be hard to see which command caused the test to fail.
Best Wishes
Phillip
Re: [PATCH v3] bugreport: reject positional arguments
Re: [PATCH v3] bugreport: reject positional arguments
In reply to Phillip WoodQuoted 3 lines · Phillip Wood
It is rather unfortunate that
test_i18ngrepwas deprecated without providing an alternative that offers the same debugging experience.
The primary thing test_i18ngrep did was to _SKIP_ certain test that looked for an expected string in "C" locale from the output when the tests were run under a tainted localization mode. The tests that looked for strings in messages that are *not* to be localized used "grep". Tests that (unfortunately) had to match human-readable messages had to work around the tainted localization test to use test_i18ngrep.
Quoted 5 lines
When
test_i18ngrepfails it prints a message with the pattern and text that failed to match so it is easy to see where the test failed. If grep fails there is no output and so unless the test is run with "-x" it can be hard to see which command caused the test to fail.
We could rename test_i18ngrep to test_grep (and make test_i18ngrep into a thin wrapper with warnings).
test_grep -e must-exist file && test_grep ! -e must-not-exist file
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 20 lines · Junio C Hamano
Quoted 3 lines · Phillip Wood
It is rather unfortunate that
test_i18ngrepwas deprecated without providing an alternative that offers the same debugging experience.The primary thing
test_i18ngrepdid was to _SKIP_ certain test that looked for an expected string in "C" locale from the output when the tests were run under a tainted localization mode. The tests that looked for strings in messages that are *not* to be localized used "grep". Tests that (unfortunately) had to match human-readable messages had to work around the tainted localization test to usetest_i18ngrep.Quoted 5 lines
When
test_i18ngrepfails it prints a message with the pattern and text that failed to match so it is easy to see where the test failed. If grep fails there is no output and so unless the test is run with "-x" it can be hard to see which command caused the test to fail.
Quoted 5 lines
We could rename
test_i18ngreptotest_grep(and maketest_i18ngrepinto a thin wrapper with warnings).test_grep -e must-exist file && test_grep ! -e must-not-exist file
... as the only remaining part in test_18ngrep has no hack to work around the tainted localization tests, so "was deprecated without" is a bit too strong. There is nothing we have lost yet.
t/test-lib-functions.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
t/test-lib-functions.sh +6 -4
@@ -1208,14 +1208,16 @@ test_cmp_bin () { cmp "$@" } -# Wrapper for grep which used to be used for -# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other -# in-flight changes. Should not be used and will be removed soon. +# Deprecated - do not use this in new code test_i18ngrep () { + test_grep "$@" +} + +test_grep () { eval "last_arg=\${$#}" test -f "$last_arg" || - BUG "test_i18ngrep requires a file to read as the last parameter" + BUG "test_grep requires a file to read as the last parameter" if test $# -lt 2 || { test "x!" = "x$1" && test $# -lt 3 ; }
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 11 lines · Junio C Hamano
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Phillip Wood
It is rather unfortunate that
test_i18ngrepwas deprecated without providing an alternative that offers the same debugging experience....
We could renametest_i18ngreptotest_grep(and maketest_i18ngrepinto a thin wrapper with warnings).
Quoted 6 lines
Quoted 2 lines
test_grep -e must-exist file && test_grep ! -e must-not-exist file... as the only remaining part in
test_18ngrephas no hack to work around the tainted localization tests, so "was deprecated without" is a bit too strong. There is nothing we have lost yet.
Having said all that, when re-reading the test_i18ngrep with a fresh pair of eyes, I somehow doubt there was much upside in "debugging experience" with test_i18ngrep in the first place, and I doubt if retaining it with a new name test_grep has much value.
Given that test_i18ngrep (hence test_grep) requires you to have the haystack in a file, between
test_i18ngrep must-exist file &&
test_i18ngrep ! must-not-exist file
and
grep must-exist file &&
! grep must-not-exist file
I do not see any difference in "debugging experience" when you run
the test with "-i [-v] -d". The two cases you care about are
(1) the test expects the string "must-exist" in the file "file" but the string is not there.
(2) the test expects the string "must-not-exist" missing from the file "file", but the string is there.
The latter can clearly be seen in output from "-i -v -d" (the "grep" outputs a line with "must-not-exist" on it). The former will show silence but since you are debugging with "-d", and your haystack is in a file, after such a step fails, the test stops, and without removing the "file" even if the test piece had test_when_finished to remove it (i.e. running tests in debugging mode "-d" and immediately stopping upon failure "-i" behaves this way exactly to help you debugging), so you can go there to the TRASH_DIRECTORY yourself and inspect "file" to see what is going on anyway.
So, I dunno. Surely with a long &&-chain of steps, where a grep that expects lack of something is in the middle, it is hard to see if the lack of hit is because an earlier step failed (and the control did not reach "grep must-exist file") or because the haystack lacked the "must-exist" needle, so from that point of view, it may be nicer that "did not find an expected match" is explicitly stated.
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 55 lines · Junio C Hamano
Quoted 11 lines · Junio C Hamano
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Phillip Wood
It is rather unfortunate that
test_i18ngrepwas deprecated without providing an alternative that offers the same debugging experience....
We could renametest_i18ngreptotest_grep(and maketest_i18ngrepinto a thin wrapper with warnings).Quoted 6 lines
Quoted 2 lines
test_grep -e must-exist file && test_grep ! -e must-not-exist file... as the only remaining part in
test_18ngrephas no hack to work around the tainted localization tests, so "was deprecated without" is a bit too strong. There is nothing we have lost yet.Having said all that, when re-reading the
test_i18ngrepwith a fresh pair of eyes, I somehow doubt there was much upside in "debugging experience" withtest_i18ngrepin the first place, and I doubt if retaining it with a new nametest_grephas much value.Given that
test_i18ngrep(hencetest_grep) requires you to have the haystack in a file, between
test_i18ngrepmust-exist file &&
test_i18ngrep! must-not-exist fileand
grep must-exist file &&
! grep must-not-exist fileI do not see any difference in "debugging experience" when you run
the test with "-i [-v] -d". The two cases you care about are(1) the test expects the string "must-exist" in the file "file" but the string is not there.
(2) the test expects the string "must-not-exist" missing from the file "file", but the string is there.
The latter can clearly be seen in output from "-i -v -d" (the "grep" outputs a line with "must-not-exist" on it). The former will show silence but since you are debugging with "-d", and your haystack is in a file, after such a step fails, the test stops, and without removing the "file" even if the test piece had
test_when_finishedto remove it (i.e. running tests in debugging mode "-d" and immediately stopping upon failure "-i" behaves this way exactly to help you debugging), so you can go there to theTRASH_DIRECTORYyourself and inspect "file" to see what is going on anyway.
Quoted 7 lines
So, I dunno. Surely with a long &&-chain of steps, where a grep that expects lack of something is in the middle, it is hard to see if the lack of hit is because an earlier step failed (and the control did not reach "grep must-exist file") or because the haystack lacked the "must-exist" needle, so from that point of view, it may be nicer that "did not find an expected match" is explicitly stated.
It is this latter point that I had in mind. I find it much easier to debug a test that says "This command failed" rather than looking at the output to try and figure out which was the last successful command. I take your point above that one can go and inspect the file when the test is run with "-i -d" but it is determining that grep failed in the first place that I find annoying. I've also found the output from test_i18ngrep is helpful when debugging CI test failures.
Best Wishes
Phillip
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 3 lines · Phillip Wood
... it is determining that grep
failed in the first place that I find annoying. I've also found the output fromtest_i18ngrepis helpful when debugging CI test failures.
Thanks, I agree with you that it is very useful for debugging to have an explicit "I did not find what I expected to see". On the other hand, the other side is not as severe a problem, I think. If "grep" expects not to see an error message in the output but the output has the error we do not want to see, we will see the message in the "-v" output when we run test.
So, when we retire test_i18ngrep, what we will primarily miss is this form of its invocation:
test_i18ngrep ! <arguments>... <file>
We have a bit more than 100 of them in the t/ hierarchy.
I wonder if it is better to drop support for the positive side, which allows us to lose the '!' and give it a name better than "grep", e.g., with only the negative match support, what we used to write:
test_must_fail git rebase -i primary >output 2>&1 && test_i18ngrep "would be overwritten by checkout:" output && test_i18ngrep ! "BUG" output
would become something like:
test_must_fail git rebase -i primary >output 2>&1 && grep "would be overwritten by checkout:" output && test_missing "BUG" output
But perhaps it is making it too limited for very little gain. We could add "test_grep" that does not do anything more than "grep", to complement, i.e.,
test_must_fail git rebase -i primary >output 2>&1 && test_grep "would be overwritten by checkout:" output && test_missing "BUG" output
But if we add "test_grep", those who have experience with writing and reading our tests will expect "test_grep !" to behave like how test_i18ngrep behaved, so we will have to support its negation anyway, i.e. test_missing will either become unnecessary or become a thin wrapper,
test_missing () { test_grep ! "$@" }merely for readability.
I haven't made up my mind on the positive side, but the negative side (aka "retiring use of 'test_i18ngrep !' from everywhere and use test_missing instead") would look like this:
t/test-lib-functions.sh | 18 ++++++++++++++++++ t/t0041-usage.sh | 12 ++++++------ t/t1060-object-corruption.sh | 2 +- t/t1091-sparse-checkout-builtin.sh | 14 +++++++------- t/t1430-bad-ref-name.sh | 2 +- t/t1450-fsck.sh | 4 ++-- t/t1506-rev-parse-diagnosis.sh | 2 +- t/t2019-checkout-ambiguous-ref.sh | 4 ++-- t/t2020-checkout-detach.sh | 4 ++-- t/t2024-checkout-dwim.sh | 4 ++-- t/t2402-worktree-list.sh | 2 +- t/t3404-rebase-interactive.sh | 2 +- t/t3507-cherry-pick-conflict.sh | 2 +- t/t3600-rm.sh | 2 +- t/t4001-diff-rename.sh | 2 +- t/t4014-format-patch.sh | 2 +- t/t4018-diff-funcname.sh | 12 ++++++------ t/t4153-am-resume-override-opts.sh | 2 +- t/t5324-split-commit-graph.sh | 2 +- t/t5505-remote.sh | 2 +- t/t5520-pull.sh | 2 +- t/t5523-push-upstream.sh | 8 ++++---- t/t5534-push-signed.sh | 2 +- t/t5541-http-push-smart.sh | 4 ++-- t/t5574-fetch-output.sh | 2 +- t/t5580-unc-paths.sh | 2 +- t/t5606-clone-options.sh | 2 +- t/t6001-rev-list-graft.sh | 2 +- t/t6040-tracking-info.sh | 4 ++-- t/t6050-replace.sh | 2 +- t/t6423-merge-rename-directories.sh | 12 ++++++------ t/t6433-merge-toplevel.sh | 2 +- t/t6437-submodule-merge.sh | 2 +- t/t6500-gc.sh | 2 +- t/t7400-submodule-basic.sh | 16 ++++++++-------- t/t7414-submodule-mistakes.sh | 6 +++--- t/t7416-submodule-dash-url.sh | 2 +- t/t7450-bad-git-dotfiles.sh | 2 +- t/t7502-commit-porcelain.sh | 10 +++++----- t/t7508-status.sh | 8 ++++---- t/t7518-ident-corner-cases.sh | 2 +- t/t7519-status-fsmonitor.sh | 4 ++-- t/t7520-ignored-hook-warning.sh | 6 +++--- t/t7601-merge-pull-config.sh | 38 ++++++++++++++++++------------------- t/t7810-grep.sh | 2 +- t/t7816-grep-binary-pattern.sh | 2 +- t/t9800-git-p4-basic.sh | 2 +- t/t9807-git-p4-submit.sh | 2 +- 48 files changed, 132 insertions(+), 114 deletions(-)
t/test-lib-functions.sh +18 -0
@@ -1245,6 +1245,24 @@ test_i18ngrep () { return 1 } +test_missing () { + eval "last_arg=\${$#}" + + test -f "$last_arg" || + BUG "test_missing requires a file to read as the last parameter" + + ! grep "$@" && return 0 + + echo >&4 "error: '! grep $@' did find a match in:" + if test -s "$last_arg" + then + cat >&4 "$last_arg" + else + echo >&4 "<file '$last_arg' is empty>" + fi + return 1 +} + # Check if the file expected to be empty is indeed empty, and barfs # otherwise.
t/t0041-usage.sh +6 -6
@@ -22,7 +22,7 @@ test_expect_success 'tag --contains <inexistent_tag>' ' test_must_fail git tag --contains "notag" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'tag --no-contains <existent_tag>' '
@@ -35,7 +35,7 @@ test_expect_success 'tag --no-contains <inexistent_tag>' ' test_must_fail git tag --no-contains "notag" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'tag usage error' '
@@ -54,7 +54,7 @@ test_expect_success 'branch --contains <inexistent_commit>' ' test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'branch --no-contains <existent_commit>' '
@@ -67,7 +67,7 @@ test_expect_success 'branch --no-contains <inexistent_commit>' ' test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'branch usage error' '
@@ -86,7 +86,7 @@ test_expect_success 'for-each-ref --contains <inexistent_object>' ' test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'for-each-ref --no-contains <existent_object>' '
@@ -99,7 +99,7 @@ test_expect_success 'for-each-ref --no-contains <inexistent_object>' ' test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && test_line_count = 0 actual && test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_missing "usage" actual.err ' test_expect_success 'for-each-ref usage error' '
t/t1060-object-corruption.sh +1 -1
@@ -125,7 +125,7 @@ test_expect_success 'fetch into corrupted repo with index-pack' ' cd bit-error-cp && test_must_fail git -c transfer.unpackLimit=1 \ fetch ../no-bit-error 2>stderr && - test_i18ngrep ! -i collision stderr + test_missing -i collision stderr ) '
t/t1091-sparse-checkout-builtin.sh +7 -7
@@ -230,7 +230,7 @@ test_expect_success 'cone mode: match patterns' ' git -C repo config --worktree core.sparseCheckoutCone true && rm -rf repo/a repo/folder1 repo/folder2 && git -C repo read-tree -mu HEAD 2>err && - test_i18ngrep ! "disabling cone patterns" err && + test_missing "disabling cone patterns" err && git -C repo reset --hard && check_files repo a folder1 folder2 '
@@ -401,8 +401,8 @@ test_expect_success 'revert to old sparse-checkout on empty update' ' git add file && git commit -m "test" && git sparse-checkout set nothing 2>err && - test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err && - test_i18ngrep ! ".git/index.lock" err && + test_missing "Sparse checkout leaves no entry on working directory" err && + test_missing ".git/index.lock" err && git sparse-checkout set --no-cone file ) '
@@ -418,7 +418,7 @@ test_expect_success '.gitignore should not warn about cone mode' ' git -C repo config --worktree core.sparseCheckoutCone true && echo "**/bin/*" >repo/.gitignore && git -C repo reset --hard 2>err && - test_i18ngrep ! "disabling cone patterns" err + test_missing "disabling cone patterns" err ' test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' '
@@ -495,7 +495,7 @@ test_expect_failure 'sparse-checkout reapply' ' git -C tweak checkout HEAD deep/deeper2/a && git -C tweak sparse-checkout reapply 2>err && - test_i18ngrep ! "warning.*The following paths are not up to date" err && + test_missing "warning.*The following paths are not up to date" err && test_path_is_missing tweak/deep/deeper2/a && test_i18ngrep "warning.*The following paths are unmerged" err && test_path_is_file tweak/folder1/a &&
@@ -578,7 +578,7 @@ test_expect_success 'check-rules interaction with submodules' ' git -C super ls-tree --name-only -r HEAD >all-files && git -C super sparse-checkout check-rules >check-rules-matches <all-files && - test_i18ngrep ! "modules/" check-rules-matches && + test_missing "modules/" check-rules-matches && test_i18ngrep "folder1/" check-rules-matches '
@@ -947,7 +947,7 @@ test_expect_success 'check-rules cone mode' ' git -C repo sparse-checkout check-rules >check-rules-default <all-files && test_i18ngrep "deep/deeper1/deepest/a" check-rules-file && - test_i18ngrep ! "deep/deeper2" check-rules-file && + test_missing "deep/deeper2" check-rules-file && test_cmp check-rules-file ls-files && test_cmp check-rules-file check-rules-default
t/t1430-bad-ref-name.sh +1 -1
@@ -173,7 +173,7 @@ test_expect_success 'for-each-ref emits warnings for broken names' ' ! grep -e "badname" output && ! grep -e "broken\.\.\.symref" output && test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error && - test_i18ngrep ! "ignoring broken ref refs/heads/badname" error && + test_missing "ignoring broken ref refs/heads/badname" error && test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error '
t/t1450-fsck.sh +2 -2
@@ -343,7 +343,7 @@ test_expect_success 'unparseable tree object' ' test_must_fail git fsck 2>out && test_i18ngrep "error: empty filename in tree entry" out && test_i18ngrep "$tree_sha1" out && - test_i18ngrep ! "fatal: empty filename in tree entry" out + test_missing "fatal: empty filename in tree entry" out ' test_expect_success 'tree entry with type mismatch' '
@@ -361,7 +361,7 @@ test_expect_success 'tree entry with type mismatch' ' git update-ref refs/heads/type_mismatch $commit && test_must_fail git fsck >out 2>&1 && test_i18ngrep "is a blob, not a tree" out && - test_i18ngrep ! "dangling blob" out + test_missing "dangling blob" out ' test_expect_success 'tree entry with bogus mode' '
t/t1506-rev-parse-diagnosis.sh +1 -1
@@ -171,7 +171,7 @@ test_expect_success 'relative path when cwd is outside worktree' ' 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_missing "exists on disk" error && test_i18ngrep "no such path in the working tree" error && cat >expect <<-\EOF && file.txt
t/t2019-checkout-ambiguous-ref.sh +2 -2
@@ -33,7 +33,7 @@ test_expect_success 'checkout chooses branch over tag' ' test_expect_success 'checkout reports switch to branch' ' test_i18ngrep "Switched to branch" stderr && - test_i18ngrep ! "^HEAD is now at" stderr + test_missing "^HEAD is now at" stderr ' test_expect_success 'checkout vague ref succeeds' '
@@ -55,7 +55,7 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' ' test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' ' test_i18ngrep "Switched to branch" stderr && - test_i18ngrep ! "^HEAD is now at" stderr + test_missing "^HEAD is now at" stderr ' test_done
t/t2020-checkout-detach.sh +2 -2
@@ -18,10 +18,10 @@ check_not_detached () { PREV_HEAD_DESC='Previous HEAD position was' check_orphan_warning() { test_i18ngrep "you are leaving $2 behind" "$1" && - test_i18ngrep ! "$PREV_HEAD_DESC" "$1" + test_missing "$PREV_HEAD_DESC" "$1" } check_no_orphan_warning() { - test_i18ngrep ! "you are leaving .* commit.*behind" "$1" && + test_missing "you are leaving .* commit.*behind" "$1" && test_i18ngrep "$PREV_HEAD_DESC" "$1" }
t/t2024-checkout-dwim.sh +2 -2
@@ -110,7 +110,7 @@ test_expect_success 'checkout of branch from multiple remotes fails with advice' checkout foo 2>stderr && test_branch main && status_uno_is_clean && - test_i18ngrep ! "^hint: " stderr + test_missing "^hint: " stderr ' test_expect_success PERL 'checkout -p with multiple remotes does not print advice' '
@@ -118,7 +118,7 @@ test_expect_success PERL 'checkout -p with multiple remotes does not print advic test_might_fail git branch -D foo && git checkout -p foo 2>stderr && - test_i18ngrep ! "^hint: " stderr && + test_missing "^hint: " stderr && status_uno_is_clean '
t/t2402-worktree-list.sh +1 -1
@@ -156,7 +156,7 @@ test_expect_success '"list" all worktrees with prunable consistent with "prune"' ! grep "/unprunable *[0-9a-f].* unprunable$" out && git worktree prune --verbose 2>out && test_i18ngrep "^Removing worktrees/prunable" out && - test_i18ngrep ! "^Removing worktrees/unprunable" out + test_missing "^Removing worktrees/unprunable" out ' test_expect_success '"list" --verbose and --porcelain mutually exclusive' '
t/t3404-rebase-interactive.sh +1 -1
@@ -605,7 +605,7 @@ test_expect_success 'clean error after failed "exec"' ' 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_missing "could not open.*for reading" error ' test_expect_success 'rebase a detached HEAD' '
t/t3507-cherry-pick-conflict.sh +1 -1
@@ -563,7 +563,7 @@ test_expect_success 'cherry-pick preserves sparse-checkout' ' echo /unrelated >.git/info/sparse-checkout && git read-tree --reset -u HEAD && test_must_fail git cherry-pick -Xours picked>actual && - test_i18ngrep ! "Changes not staged for commit:" actual + test_missing "Changes not staged for commit:" actual ' test_expect_success 'cherry-pick --continue remembers --keep-redundant-commits' '
t/t3600-rm.sh +1 -1
@@ -276,7 +276,7 @@ test_expect_success 'Resolving by removal is not a warning-worthy event' ' blob=$(echo blob | git hash-object -w --stdin) && printf "100644 $blob %d\tblob\n" 1 2 3 | git update-index --index-info && git rm blob >msg 2>&1 && - test_i18ngrep ! "needs merge" msg && + test_missing "needs merge" msg && test_must_fail git ls-files -s --error-unmatch blob '
t/t4001-diff-rename.sh +1 -1
@@ -145,7 +145,7 @@ test_expect_success 'test diff.renames=true for git status' ' 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_missing "renamed: .*path1 -> subdir/path1" out && test_i18ngrep "new file: .*subdir/path1" out && test_i18ngrep "deleted: .*[^/]path1" out '
t/t4014-format-patch.sh +1 -1
@@ -2404,7 +2404,7 @@ test_expect_success 'interdiff: cover-letter' ' EOF git format-patch --cover-letter --interdiff=boop~2 -1 boop && test_i18ngrep "^Interdiff:$" 0000-cover-letter.patch && - test_i18ngrep ! "^Interdiff:$" 0001-fleep.patch && + test_missing "^Interdiff:$" 0001-fleep.patch && sed "1,/^@@ /d; /^-- $/q" 0000-cover-letter.patch >actual && test_cmp expect actual '
t/t4018-diff-funcname.sh +6 -6
@@ -53,15 +53,15 @@ do echo "*.java diff=$p" >.gitattributes && test_expect_code 1 git diff --no-index \ A.java B.java 2>msg && - test_i18ngrep ! fatal msg && - test_i18ngrep ! error msg + test_missing fatal msg && + test_missing error msg ' test_expect_success "builtin $p wordRegex pattern compiles" ' echo "*.java diff=$p" >.gitattributes && test_expect_code 1 git diff --no-index --word-diff \ A.java B.java 2>msg && - test_i18ngrep ! fatal msg && - test_i18ngrep ! error msg + test_missing fatal msg && + test_missing error msg ' test_expect_success "builtin $p pattern compiles on bare repo with --attr-source" '
@@ -79,8 +79,8 @@ do git -C bare.git symbolic-ref HEAD refs/heads/master && test_expect_code 1 git -C bare.git --attr-source=branchA \ diff --exit-code HEAD:A.java HEAD:B.java 2>msg && - test_i18ngrep ! fatal msg && - test_i18ngrep ! error msg + test_missing fatal msg && + test_missing error msg ' done
t/t4153-am-resume-override-opts.sh +1 -1
@@ -53,7 +53,7 @@ test_expect_success '--no-quiet overrides --quiet' ' # Applying side1 will be quiet. test_must_fail git am --quiet side[123].eml >out && test_path_is_dir .git/rebase-apply && - test_i18ngrep ! "^Applying: " out && + test_missing "^Applying: " out && echo side1 >file && git add file &&
t/t5324-split-commit-graph.sh +1 -1
@@ -422,7 +422,7 @@ test_expect_success 'add octopus merge' ' git commit-graph verify --progress 2>err && test_line_count = 1 err && grep "Verifying commits in commit graph: 100% (18/18)" err && - test_i18ngrep ! warning err && + test_missing warning err && test_line_count = 3 $graphdir/commit-graph-chain '
t/t5505-remote.sh +1 -1
@@ -1458,7 +1458,7 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' ' test_must_fail git -c advice.pushUnqualifiedRefName=false \ push origin $oid:dst 2>err && test_i18ngrep "error: The destination you" err && - test_i18ngrep ! "hint: Did you mean" err || + test_missing "hint: Did you mean" err || exit 1 done )
t/t5520-pull.sh +1 -1
@@ -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 + test_missing "verify-signatures" err ' # add a feature branch, keep-merge, that is merged into main, so the
t/t5523-push-upstream.sh +4 -4
@@ -95,7 +95,7 @@ test_expect_success 'progress messages do not go to non-tty' ' # skip progress messages, since stderr is non-tty git push -u upstream main >out 2>err && - test_i18ngrep ! "Writing objects" err + test_missing "Writing objects" err ' test_expect_success 'progress messages go to non-tty (forced)' '
@@ -110,15 +110,15 @@ test_expect_success TTY 'push -q suppresses progress' ' ensure_fresh_upstream && test_terminal git push -u -q upstream main >out 2>err && - test_i18ngrep ! "Writing objects" err + test_missing "Writing objects" err ' test_expect_success TTY 'push --no-progress suppresses progress' ' ensure_fresh_upstream && test_terminal git push -u --no-progress upstream main >out 2>err && - test_i18ngrep ! "Unpacking objects" err && - test_i18ngrep ! "Writing objects" err + test_missing "Unpacking objects" err && + test_missing "Writing objects" err ' test_expect_success TTY 'quiet push' '
t/t5534-push-signed.sh +1 -1
@@ -378,7 +378,7 @@ test_expect_success GPG 'failed atomic push does not execute GPG' ' --signed --atomic --porcelain \ dst noop ff noff >out 2>err && - test_i18ngrep ! "gpg failed to sign" err && + test_missing "gpg failed to sign" err && cat >expect <<-EOF && To dst = refs/heads/noop:refs/heads/noop [up to date]
t/t5541-http-push-smart.sh +2 -2
@@ -312,7 +312,7 @@ test_expect_success TTY 'push --no-progress silences progress but not status' ' test_commit no-progress && test_terminal git push --no-progress >output 2>&1 && test_i18ngrep "^To http" output && - test_i18ngrep ! "^Writing objects" output + test_missing "^Writing objects" output ' test_expect_success 'push --progress shows progress to non-tty' '
@@ -492,7 +492,7 @@ test_expect_success 'colorize errors/hints' ' test_i18ngrep "<RED>.*rejected.*<RESET>" decoded && test_i18ngrep "<RED>error: failed to push some refs" decoded && test_i18ngrep "<YELLOW>hint: " decoded && - test_i18ngrep ! "^hint: " decoded + test_missing "^hint: " decoded ' test_expect_success 'report error server does not provide ref status' '
t/t5574-fetch-output.sh +1 -1
@@ -286,7 +286,7 @@ test_expect_success '--no-show-forced-updates' ' ( cd no-forced-update-clone && git fetch --no-show-forced-updates origin 2>output && - test_i18ngrep ! "(forced update)" output + test_missing "(forced update)" output ) '
t/t5580-unc-paths.sh +1 -1
@@ -75,7 +75,7 @@ test_expect_success push ' test_expect_success MINGW 'remote nick cannot contain backslashes' ' BACKSLASHED="$(winpwd | tr / \\\\)" && git ls-remote "$BACKSLASHED" 2>err && - test_i18ngrep ! "unable to access" err + test_missing "unable to access" err ' test_expect_success 'unc alternates' '
t/t5606-clone-options.sh +1 -1
@@ -149,7 +149,7 @@ test_expect_success 'redirected clone does not show progress' ' git clone "file://$(pwd)/parent" clone-redirected >out 2>err && ! grep % err && - test_i18ngrep ! "Checking connectivity" err + test_missing "Checking connectivity" err '
t/t6001-rev-list-graft.sh +1 -1
@@ -121,7 +121,7 @@ test_expect_success 'show advice that grafts are deprecated' ' test_i18ngrep "git replace" err && test_config advice.graftFileDeprecated false && git show HEAD 2>err && - test_i18ngrep ! "git replace" err + test_missing "git replace" err ' test_done
t/t6040-tracking-info.sh +2 -2
@@ -253,7 +253,7 @@ test_expect_success 'fail to track lightweight tags' ' git checkout main && git tag light && test_must_fail git branch --track lighttrack light >actual && - test_i18ngrep ! "set up to track" actual && + test_missing "set up to track" actual && test_must_fail git checkout lighttrack '
@@ -261,7 +261,7 @@ test_expect_success 'fail to track annotated tags' ' git checkout main && git tag -m heavy heavy && test_must_fail git branch --track heavytrack heavy >actual && - test_i18ngrep ! "set up to track" actual && + test_missing "set up to track" actual && test_must_fail git checkout heavytrack '
t/t6050-replace.sh +1 -1
@@ -492,7 +492,7 @@ test_expect_success '--convert-graft-file' ' git status 2>stderr && test_i18ngrep "hint:.*grafts is deprecated" stderr && git replace --convert-graft-file 2>stderr && - test_i18ngrep ! "hint:.*grafts is deprecated" stderr && + test_missing "hint:.*grafts is deprecated" stderr && test_path_is_missing .git/info/grafts && : verify that the history is now "grafted" &&
t/t6423-merge-rename-directories.sh +6 -6
@@ -591,7 +591,7 @@ test_expect_success '2b: Directory split into two on one side, with equal number git rev-parse >expect \ O:z/b O:z/c B:x/d && test_cmp expect actual && - test_i18ngrep ! "CONFLICT.*directory rename split" out + test_missing "CONFLICT.*directory rename split" out ) '
@@ -727,7 +727,7 @@ test_expect_success '3b: Avoid implicit rename if involved as source on current test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out && test_i18ngrep CONFLICT.*rename/rename.*z/d.*x/d.*w/d out && - test_i18ngrep ! CONFLICT.*rename/rename.*y/d out && + test_missing CONFLICT.*rename/rename.*y/d out && git ls-files -s >out && test_line_count = 5 out &&
@@ -3606,7 +3606,7 @@ test_expect_merge_algorithm failure success '10e: Does git complain about untrac echo random >z/c && git -c merge.directoryRenames=true merge -s recursive B^0 >out 2>err && - test_i18ngrep ! "following untracked working tree files would be overwritten by merge" err && + test_missing "following untracked working tree files would be overwritten by merge" err && git ls-files -s >out && test_line_count = 3 out &&
@@ -5821,9 +5821,9 @@ test_expect_success '13e: directory rename detection in recursive case' ' git -c merge.directoryRenames=conflict merge -s recursive C^0 >out 2>err && - test_i18ngrep ! CONFLICT out && - test_i18ngrep ! BUG: err && - test_i18ngrep ! core.dumped err && + test_missing CONFLICT out && + test_missing BUG: err && + test_missing core.dumped err && test_must_be_empty err && git ls-files >paths &&
t/t6433-merge-toplevel.sh +1 -1
@@ -152,7 +152,7 @@ test_expect_success 'refuse two-project merge by default, quit before --autostas echo change >>one.t && git diff >expect && test_must_fail git merge --autostash five 2>err && - test_i18ngrep ! "stash" err && + test_missing "stash" err && git diff >actual && test_cmp expect actual '
t/t6437-submodule-merge.sh +1 -1
@@ -480,7 +480,7 @@ test_expect_merge_algorithm failure success !FAIL_PREREQS 'directory/submodule c # We do not want files within the submodule to prevent the # merge from starting; we should not be writing to such paths # anyway. - test_i18ngrep ! "refusing to lose untracked file at" err + test_missing "refusing to lose untracked file at" err ) '
t/t6500-gc.sh +1 -1
@@ -155,7 +155,7 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre test_commit "$(test_oid obj4)" && git gc --auto 2>err && - test_i18ngrep ! "^warning:" err && + test_missing "^warning:" err && ls .git/objects/pack/pack-*.pack | sort >post_packs && comm -1 -3 existing_packs post_packs >new && comm -2 -3 existing_packs post_packs >del &&
t/t7400-submodule-basic.sh +8 -8
@@ -196,7 +196,7 @@ test_expect_success 'redirected submodule add does not show progress' ' git -C addtest submodule add "file://$submodurl/parent" submod-redirected \ 2>err && ! grep % err && - test_i18ngrep ! "Checking connectivity" err + test_missing "Checking connectivity" err ' test_expect_success 'redirected submodule add --progress does show progress' '
@@ -1160,7 +1160,7 @@ test_expect_success 'submodule deinit deinits a submodule when its work tree is git submodule deinit init example2 >actual && test -z "$(git config --get-regexp "submodule\.example\.")" && test -z "$(git config --get-regexp "submodule\.example2\.")" && - test_i18ngrep ! "Cleared directory .init" actual && + test_missing "Cleared directory .init" actual && test_i18ngrep "Cleared directory .example2" actual && rmdir init '
@@ -1210,19 +1210,19 @@ test_expect_success 'submodule deinit is silent when used on an uninitialized su test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual && test_i18ngrep "Cleared directory .init" actual && git submodule deinit init >actual && - test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual && + test_missing "Submodule .example. (.*) unregistered for path .init" actual && test_i18ngrep "Cleared directory .init" actual && git submodule deinit . >actual && - test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual && + test_missing "Submodule .example. (.*) unregistered for path .init" actual && test_i18ngrep "Submodule .example2. (.*) unregistered for path .example2" actual && test_i18ngrep "Cleared directory .init" actual && git submodule deinit . >actual && - test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual && - test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual && + test_missing "Submodule .example. (.*) unregistered for path .init" actual && + test_missing "Submodule .example2. (.*) unregistered for path .example2" actual && test_i18ngrep "Cleared directory .init" actual && git submodule deinit --all >actual && - test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual && - test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual && + test_missing "Submodule .example. (.*) unregistered for path .init" actual && + test_missing "Submodule .example2. (.*) unregistered for path .example2" actual && test_i18ngrep "Cleared directory .init" actual && rmdir init example2 '
t/t7414-submodule-mistakes.sh +3 -3
@@ -19,7 +19,7 @@ test_expect_success 'git-add on embedded repository warns' ' test_expect_success '--no-warn-embedded-repo suppresses warning' ' test_when_finished "git rm --cached -f embed" && git add --no-warn-embedded-repo embed 2>stderr && - test_i18ngrep ! warning stderr + test_missing warning stderr ' test_expect_success 'no warning when updating entry' '
@@ -27,14 +27,14 @@ test_expect_success 'no warning when updating entry' ' git add embed && git -C embed commit --allow-empty -m two && git add embed 2>stderr && - test_i18ngrep ! warning stderr + test_missing warning stderr ' test_expect_success 'submodule add does not warn' ' test_when_finished "git rm -rf submodule .gitmodules" && git -c protocol.file.allow=always \ submodule add ./embed submodule 2>stderr && - test_i18ngrep ! warning stderr + test_missing warning stderr ' test_done
t/t7416-submodule-dash-url.sh +1 -1
@@ -63,7 +63,7 @@ test_expect_success 'trailing backslash is handled correctly' ' mv .new .gitmodules && git commit -am "Add testmodule" && test_must_fail git clone --verbose --recurse-submodules . dolly 2>err && - test_i18ngrep ! "unknown option" err + test_missing "unknown option" err ' test_expect_success 'fsck rejects missing URL scheme' '
t/t7450-bad-git-dotfiles.sh +1 -1
@@ -253,7 +253,7 @@ test_expect_success 'fsck detects corrupt .gitmodules' ' git fsck 2>output && test_i18ngrep gitmodulesParse output && - test_i18ngrep ! "bad config" output + test_missing "bad config" output ) '
t/t7502-commit-porcelain.sh +5 -5
@@ -860,7 +860,7 @@ try_commit () { GIT_EDITOR=.git/FAKE_EDITOR git commit -a $* $use_template && case "$use_template" in '') - test_i18ngrep ! "^## Custom template" .git/COMMIT_EDITMSG ;; + test_missing "^## Custom template" .git/COMMIT_EDITMSG ;; *) test_i18ngrep "^## Custom template" .git/COMMIT_EDITMSG ;; esac
@@ -880,7 +880,7 @@ try_commit_status_combo () { test_expect_success 'commit --no-status' ' try_commit --no-status && - test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_missing "^# Changes to be committed:" .git/COMMIT_EDITMSG ' test_expect_success 'commit with commit.status = yes' '
@@ -892,7 +892,7 @@ try_commit_status_combo () { test_expect_success 'commit with commit.status = no' ' test_config commit.status no && try_commit "" && - test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_missing "^# Changes to be committed:" .git/COMMIT_EDITMSG ' test_expect_success 'commit --status with commit.status = yes' '
@@ -904,7 +904,7 @@ try_commit_status_combo () { test_expect_success 'commit --no-status with commit.status = yes' ' test_config commit.status yes && try_commit --no-status && - test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_missing "^# Changes to be committed:" .git/COMMIT_EDITMSG ' test_expect_success 'commit --status with commit.status = no' '
@@ -916,7 +916,7 @@ try_commit_status_combo () { test_expect_success 'commit --no-status with commit.status = no' ' test_config commit.status no && try_commit --no-status && - test_i18ngrep ! "^# Changes to be committed:" .git/COMMIT_EDITMSG + test_missing "^# Changes to be committed:" .git/COMMIT_EDITMSG ' }
t/t7508-status.sh +4 -4
@@ -1547,7 +1547,7 @@ test_expect_success 'git commit will commit a staged but ignored submodule' ' export GIT_EDITOR && git commit -uno && git status -s --ignore-submodules=dirty >output && - test_i18ngrep ! "^M. sm" output + test_missing "^M. sm" output ' test_expect_success 'git commit --dry-run will show a staged but ignored submodule' '
@@ -1578,7 +1578,7 @@ EOF test_expect_success 'git commit -m will commit a staged but ignored submodule' ' git commit -uno -m message && git status -s --ignore-submodules=dirty >output && - test_i18ngrep ! "^M. sm" output && + test_missing "^M. sm" output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname '
@@ -1625,7 +1625,7 @@ test_expect_success '"No commits yet" should not be noted in status output' ' git checkout --orphan empty-branch-2 && test_commit test-commit-1 && git status >output && - test_i18ngrep ! "No commits yet" output + test_missing "No commits yet" output ' test_expect_success '"Initial commit" should be noted in commit template' '
@@ -1642,7 +1642,7 @@ test_expect_success '"Initial commit" should not be noted in commit template' ' touch to_be_committed_2 && git add to_be_committed_2 && git commit --dry-run >output && - test_i18ngrep ! "Initial commit" output + test_missing "Initial commit" output ' test_expect_success '--no-optional-locks prevents index update' '
t/t7518-ident-corner-cases.sh +1 -1
@@ -15,7 +15,7 @@ test_expect_success 'empty name and missing email' ' sane_unset GIT_AUTHOR_EMAIL && GIT_AUTHOR_NAME= && test_must_fail git commit --allow-empty -m foo 2>err && - test_i18ngrep ! "(null)" err + test_missing "(null)" err ) '
t/t7519-status-fsmonitor.sh +2 -2
@@ -322,10 +322,10 @@ do rm -f marker && git status >actual && test_path_is_file marker && - test_i18ngrep ! "Changes not staged for commit:" actual && + test_missing "Changes not staged for commit:" actual && if test $uc_val = true then - test_i18ngrep ! "Untracked files:" actual + test_missing "Untracked files:" actual fi && if test $uc_val = false then
t/t7520-ignored-hook-warning.sh +3 -3
@@ -13,7 +13,7 @@ test_expect_success setup ' test_expect_success 'no warning if hook is not ignored' ' git commit --allow-empty -m "more" 2>message && - test_i18ngrep ! -e "hook was ignored" message + test_missing -e "hook was ignored" message ' test_expect_success POSIXPERM 'warning if hook is ignored' '
@@ -26,14 +26,14 @@ test_expect_success POSIXPERM 'no warning if advice.ignoredHook set to false' ' test_config advice.ignoredHook false && test_hook --disable pre-commit && git commit --allow-empty -m "even more" 2>message && - test_i18ngrep ! -e "hook was ignored" message + test_missing -e "hook was ignored" message ' test_expect_success 'no warning if unset advice.ignoredHook and hook removed' ' test_hook --remove pre-commit && test_unconfig advice.ignoredHook && git commit --allow-empty -m "even more" 2>message && - test_i18ngrep ! -e "hook was ignored" message + test_missing -e "hook was ignored" message ' test_done
t/t7601-merge-pull-config.sh +19 -19
@@ -30,58 +30,58 @@ test_expect_success 'setup' ' test_expect_success 'pull.rebase not set, ff possible' ' git reset --hard c0 && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and pull.ff=true' ' git reset --hard c0 && test_config pull.ff true && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and pull.ff=false' ' git reset --hard c0 && test_config pull.ff false && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and pull.ff=only' ' git reset --hard c0 && test_config pull.ff only && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --rebase given' ' git reset --hard c0 && git pull --rebase . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --no-rebase given' ' git reset --hard c0 && git pull --no-rebase . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --ff given' ' git reset --hard c0 && git pull --ff . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --no-ff given' ' git reset --hard c0 && git pull --no-ff . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --ff-only given' ' git reset --hard c0 && git pull --ff-only . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set (not-fast-forward)' '
@@ -96,51 +96,51 @@ test_expect_success 'pull.rebase not set and pull.ff=true (not-fast-forward)' ' git reset --hard c2 && test_config pull.ff true && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and pull.ff=false (not-fast-forward)' ' git reset --hard c2 && test_config pull.ff false && git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and pull.ff=only (not-fast-forward)' ' git reset --hard c2 && test_config pull.ff only && test_must_fail git pull . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --rebase given (not-fast-forward)' ' git reset --hard c2 && git pull --rebase . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --no-rebase given (not-fast-forward)' ' git reset --hard c2 && git pull --no-rebase . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --ff given (not-fast-forward)' ' git reset --hard c2 && git pull --ff . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --no-ff given (not-fast-forward)' ' git reset --hard c2 && git pull --no-ff . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_expect_success 'pull.rebase not set and --ff-only given (not-fast-forward)' ' git reset --hard c2 && test_must_fail git pull --ff-only . c1 2>err && - test_i18ngrep ! "You have divergent branches" err + test_missing "You have divergent branches" err ' test_does_rebase () {
@@ -334,7 +334,7 @@ test_expect_success 'Multiple heads warns about inability to fast forward' ' test_expect_success 'Multiple can never be fast forwarded' ' git reset --hard c0 && test_must_fail git -c pull.ff=only pull . c1 c2 c3 2>err && - test_i18ngrep ! "You have divergent branches" err && + test_missing "You have divergent branches" err && # In addition to calling out "cannot fast-forward", we very much # want the "multiple branches" piece to be called out to users. test_i18ngrep "Cannot fast-forward to multiple branches" err
@@ -343,7 +343,7 @@ test_expect_success 'Multiple can never be fast forwarded' ' test_expect_success 'Cannot rebase with multiple heads' ' git reset --hard c0 && test_must_fail git -c pull.rebase=true pull . c1 c2 c3 2>err && - test_i18ngrep ! "You have divergent branches" err && + test_missing "You have divergent branches" err && test_i18ngrep "Cannot rebase onto multiple branches." err '
t/t7810-grep.sh +1 -1
@@ -1426,7 +1426,7 @@ test_expect_success 'grep --no-index prefers paths to revs' ' test_expect_success 'grep --no-index does not "diagnose" revs' ' test_must_fail git grep --no-index o :1:hello.c 2>err && - test_i18ngrep ! -i "did you mean" err + test_missing -i "did you mean" err ' cat >expected <<EOF
t/t7816-grep-binary-pattern.sh +1 -1
@@ -26,7 +26,7 @@ nul_match_internal () { >stderr && printf '$pattern' | q_to_nul >f && test_must_fail env LC_ALL=\"$lc_all\" git grep $extra_flags -f f $flags a 2>stderr && - test_i18ngrep ! 'This is only supported with -P under PCRE v2' stderr + test_missing 'This is only supported with -P under PCRE v2' stderr " elif test "$matches" = P then
t/t9800-git-p4-basic.sh +1 -1
@@ -290,7 +290,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' ' export PATH && test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1 ) && - test_i18ngrep ! Traceback errs + test_missing Traceback errs ' # Hide a file from p4d, make sure we catch its complaint. This won't fail in
t/t9807-git-p4-submit.sh +1 -1
@@ -463,7 +463,7 @@ test_expect_success 'submit --prepare-p4-only' ' git p4 submit --prepare-p4-only >out && test_i18ngrep "prepared for submission" out && test_i18ngrep "must be deleted" out && - test_i18ngrep ! "everything below this line is just the diff" out + test_missing "everything below this line is just the diff" out ) && ( cd "$cli" &&
Re: [PATCH v3] bugreport: reject positional arguments
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Phillip Wood
... it is determining that grep
failed in the first place that I find annoying. I've also found the output fromtest_i18ngrepis helpful when debugging CI test failures.
Quoted 6 lines
Thanks, I agree with you that it is very useful for debugging to have an explicit "I did not find what I expected to see". On the other hand, the other side is not as severe a problem, I think. If "grep" expects not to see an error message in the output but the output has the error we do not want to see, we will see the message in the "-v" output when we run test.
Everything I wrote above makes sense, but what I continued this message with (below---omitted) is total opposite. Let's discard and maybe retry sometime later.
cover Deprecate test_i18ngrep further
In reply to Phillip WoodAs an attempt to come up with a useful mechanism to ensure that certain messages are left untranslated [*], we earlier wrote GIT_TEST_GETTEXT_POISON off as a failed experiment.
But the output from the test helper was easier to use while debugging failed tests, compared to the same test writtein with the plain-vanilla "grep". Especially when a test that expects a certain string to appear in the output (e.g. "this test must fail with this message") fails, "grep message output" would just silently fail and in a &&-chained sequence of commands, it is hard to tell which step failed. test_i18ngrep explicitly said "we wanted to see a line that match this pattern but did not see a hit in this file".
Let's introduce test_grep and replace existing uses of test_i18ngrep with it. The helper is still useful, but now has nothing to do with i18n.
Junio C Hamano (2):
test framework: further deprecate test_i18ngrep
tests: teach callers of test_i18ngrep to use test_grep
t/lib-httpd.sh | 2 +- t/lib-submodule-update.sh | 2 +- t/t0001-init.sh | 16 +-- t/t0002-gitfile.sh | 4 +- t/t0003-attributes.sh | 4 +- t/t0008-ignores.sh | 4 +- t/t0012-help.sh | 16 +-- t/t0013-sha1dc.sh | 2 +- t/t0014-alias.sh | 8 +- t/t0021-conversion.sh | 6 +- t/t0028-working-tree-encoding.sh | 32 ++--- t/t0040-parse-options.sh | 4 +- t/t0041-usage.sh | 32 ++--- t/t0061-run-command.sh | 6 +- t/t0070-fundamental.sh | 4 +- t/t0091-bugreport.sh | 2 +- t/t0300-credentials.sh | 2 +- t/t1060-object-corruption.sh | 2 +- t/t1091-sparse-checkout-builtin.sh | 68 ++++----- t/t1092-sparse-checkout-compatibility.sh | 6 +- t/t1300-config.sh | 44 +++--- t/t1307-config-blob.sh | 2 +- t/t1308-config-set.sh | 10 +- t/t1309-early-config.sh | 2 +- t/t1310-config-default.sh | 4 +- t/t1400-update-ref.sh | 22 +-- t/t1404-update-ref-errors.sh | 4 +- t/t1410-reflog.sh | 6 +- t/t1416-ref-transaction-hooks.sh | 2 +- t/t1430-bad-ref-name.sh | 22 +-- t/t1450-fsck.sh | 80 +++++------ t/t1506-rev-parse-diagnosis.sh | 34 ++--- t/t1512-rev-parse-disambiguation.sh | 6 +- t/t2004-checkout-cache-temp.sh | 2 +- t/t2006-checkout-index-basic.sh | 14 +- t/t2010-checkout-ambiguous.sh | 4 +- t/t2018-checkout-branch.sh | 4 +- t/t2019-checkout-ambiguous-ref.sh | 8 +- t/t2020-checkout-detach.sh | 8 +- t/t2024-checkout-dwim.sh | 8 +- t/t2025-checkout-no-overlay.sh | 2 +- t/t2026-checkout-pathspec-file.sh | 8 +- t/t2027-checkout-track.sh | 2 +- t/t2030-unresolve-info.sh | 2 +- t/t2072-restore-pathspec-file.sh | 8 +- t/t2106-update-index-assume-unchanged.sh | 2 +- t/t2107-update-index-basic.sh | 4 +- t/t2203-add-intent.sh | 6 +- t/t2204-add-ignored.sh | 8 +- t/t2401-worktree-prune.sh | 10 +- t/t2402-worktree-list.sh | 6 +- t/t2403-worktree-move.sh | 2 +- t/t2406-worktree-repair.sh | 24 ++-- t/t3004-ls-files-basic.sh | 4 +- t/t3007-ls-files-recurse-submodules.sh | 4 +- t/t3200-branch.sh | 18 +-- t/t3202-show-branch.sh | 2 +- t/t3206-range-diff.sh | 22 +-- t/t3210-pack-refs.sh | 2 +- t/t3301-notes.sh | 4 +- t/t3310-notes-merge-manual-resolve.sh | 16 +-- t/t3320-notes-merge-worktrees.sh | 4 +- t/t3321-notes-stripspace.sh | 2 +- t/t3400-rebase.sh | 6 +- t/t3402-rebase-merge.sh | 2 +- t/t3403-rebase-skip.sh | 30 ++-- t/t3404-rebase-interactive.sh | 38 ++--- t/t3406-rebase-message.sh | 18 +-- t/t3418-rebase-continue.sh | 6 +- t/t3431-rebase-fork-point.sh | 2 +- t/t3501-revert-cherry-pick.sh | 6 +- t/t3507-cherry-pick-conflict.sh | 8 +- t/t3510-cherry-pick-sequence.sh | 6 +- t/t3600-rm.sh | 8 +- t/t3601-rm-pathspec-file.sh | 6 +- t/t3700-add.sh | 6 +- t/t3701-add-interactive.sh | 8 +- t/t3704-add-pathspec-file.sh | 12 +- t/t3900-i18n-commit.sh | 8 +- t/t3901-i18n-patch.sh | 2 +- t/t3903-stash.sh | 10 +- t/t3905-stash-include-untracked.sh | 2 +- t/t3909-stash-pathspec-file.sh | 6 +- t/t4001-diff-rename.sh | 34 ++--- t/t4013-diff-various.sh | 2 +- t/t4014-format-patch.sh | 12 +- t/t4015-diff-whitespace.sh | 20 +-- t/t4018-diff-funcname.sh | 14 +- t/t4031-diff-rewrite-binary.sh | 2 +- t/t4047-diff-dirstat.sh | 22 +-- t/t4053-diff-no-index.sh | 2 +- t/t4055-diff-context.sh | 4 +- t/t4068-diff-symmetric-merge-base.sh | 28 ++-- t/t4115-apply-symlink.sh | 2 +- t/t4120-apply-popt.sh | 4 +- t/t4122-apply-symlink-inside.sh | 14 +- t/t4129-apply-samemode.sh | 4 +- t/t4133-apply-filenames.sh | 8 +- t/t4150-am.sh | 4 +- t/t4151-am-abort.sh | 2 +- t/t4153-am-resume-override-opts.sh | 2 +- t/t4200-rerere.sh | 4 +- t/t4201-shortlog.sh | 2 +- t/t4202-log.sh | 18 +-- t/t4203-mailmap.sh | 2 +- t/t4208-log-magic-pathspec.sh | 6 +- t/t4209-log-pickaxe.sh | 4 +- t/t4211-line-log.sh | 4 +- t/t4212-log-corrupt.sh | 2 +- t/t4256-am-format-flowed.sh | 2 +- t/t5300-pack-object.sh | 4 +- t/t5302-pack-index.sh | 4 +- t/t5304-prune.sh | 4 +- t/t5310-pack-bitmaps.sh | 8 +- t/t5318-commit-graph.sh | 18 +-- t/t5319-multi-pack-index.sh | 10 +- t/t5324-split-commit-graph.sh | 16 +-- t/t5331-pack-objects-stdin.sh | 4 +- t/t5411/test-0026-push-options.sh | 2 +- t/t5411/test-0027-push-options--porcelain.sh | 2 +- t/t5500-fetch-pack.sh | 10 +- t/t5504-fetch-receive-strict.sh | 26 ++-- t/t5505-remote.sh | 22 +-- t/t5510-fetch.sh | 8 +- t/t5512-ls-remote.sh | 2 +- t/t5514-fetch-multiple.sh | 4 +- t/t5516-fetch-push.sh | 8 +- t/t5520-pull.sh | 34 ++--- t/t5521-pull-options.sh | 2 +- t/t5523-push-upstream.sh | 12 +- t/t5528-push-default.sh | 2 +- t/t5530-upload-pack-error.sh | 4 +- t/t5531-deep-submodule-push.sh | 2 +- t/t5534-push-signed.sh | 6 +- t/t5536-fetch-conflicts.sh | 8 +- t/t5541-http-push-smart.sh | 20 +-- t/t5545-push-options.sh | 2 +- t/t5550-http-fetch-dumb.sh | 8 +- t/t5551-http-fetch-smart.sh | 4 +- t/t5570-git-daemon.sh | 10 +- t/t5572-pull-submodule.sh | 2 +- t/t5573-pull-verify-signatures.sh | 26 ++-- t/t5574-fetch-output.sh | 4 +- t/t5580-unc-paths.sh | 2 +- t/t5601-clone.sh | 6 +- t/t5604-clone-reference.sh | 2 +- t/t5606-clone-options.sh | 10 +- t/t5607-clone-bundle.sh | 4 +- t/t5611-clone-config.sh | 4 +- t/t5616-partial-clone.sh | 22 +-- t/t5701-git-serve.sh | 8 +- t/t5702-protocol-v2.sh | 34 ++--- t/t5703-upload-pack-ref-in-want.sh | 4 +- t/t5704-protocol-violations.sh | 4 +- t/t5801-remote-helpers.sh | 8 +- t/t5812-proto-disable-http.sh | 2 +- t/t6001-rev-list-graft.sh | 4 +- t/t6021-rev-list-exclude-hidden.sh | 4 +- t/t6030-bisect-porcelain.sh | 24 ++-- t/t6040-tracking-info.sh | 18 +-- t/t6050-replace.sh | 14 +- t/t6102-rev-list-unexpected-objects.sh | 16 +-- t/t6112-rev-list-filters-objects.sh | 2 +- t/t6120-describe.sh | 2 +- t/t6134-pathspec-in-submodule.sh | 2 +- t/t6135-pathspec-with-attrs.sh | 8 +- t/t6136-pathspec-in-bare.sh | 8 +- t/t6402-merge-rename.sh | 16 +-- t/t6422-merge-rename-corner-cases.sh | 16 +-- t/t6423-merge-rename-directories.sh | 140 +++++++++---------- t/t6424-merge-unrelated-index-changes.sh | 6 +- t/t6425-merge-rename-delete.sh | 4 +- t/t6426-merge-skip-unneeded-updates.sh | 2 +- t/t6430-merge-recursive.sh | 8 +- t/t6433-merge-toplevel.sh | 4 +- t/t6436-merge-overwrite.sh | 4 +- t/t6437-submodule-merge.sh | 2 +- t/t6500-gc.sh | 14 +- t/t7001-mv.sh | 4 +- t/t7105-reset-patch.sh | 6 +- t/t7106-reset-unborn-branch.sh | 2 +- t/t7107-reset-pathspec-file.sh | 10 +- t/t7110-reset-merge.sh | 6 +- t/t7201-co.sh | 4 +- t/t7300-clean.sh | 2 +- t/t7400-submodule-basic.sh | 64 ++++----- t/t7403-submodule-sync.sh | 4 +- t/t7406-submodule-update.sh | 6 +- t/t7411-submodule-config.sh | 4 +- t/t7414-submodule-mistakes.sh | 8 +- t/t7416-submodule-dash-url.sh | 4 +- t/t7417-submodule-path-url.sh | 4 +- t/t7450-bad-git-dotfiles.sh | 12 +- t/t7500-commit-template-squash-signoff.sh | 2 +- t/t7501-commit-basic-functionality.sh | 6 +- t/t7502-commit-porcelain.sh | 32 ++--- t/t7506-status-submodule.sh | 28 ++-- t/t7507-commit-verbose.sh | 4 +- t/t7508-status.sh | 24 ++-- t/t7509-commit-authorship.sh | 4 +- t/t7518-ident-corner-cases.sh | 10 +- t/t7519-status-fsmonitor.sh | 6 +- t/t7520-ignored-hook-warning.sh | 8 +- t/t7525-status-rename.sh | 54 +++---- t/t7526-commit-pathspec-file.sh | 14 +- t/t7600-merge.sh | 30 ++-- t/t7601-merge-pull-config.sh | 50 +++---- t/t7611-merge-abort.sh | 4 +- t/t7612-merge-verify-signatures.sh | 24 ++-- t/t7703-repack-geometric.sh | 4 +- t/t7800-difftool.sh | 4 +- t/t7810-grep.sh | 4 +- t/t7811-grep-open.sh | 2 +- t/t7814-grep-recurse-submodules.sh | 2 +- t/t7816-grep-binary-pattern.sh | 4 +- t/t7900-maintenance.sh | 24 ++-- t/t8003-blame-corner-cases.sh | 2 +- t/t8013-blame-ignore-revs.sh | 6 +- t/t9001-send-email.sh | 8 +- t/t9300-fast-import.sh | 26 ++-- t/t9800-git-p4-basic.sh | 18 +-- t/t9801-git-p4-branch.sh | 2 +- t/t9807-git-p4-submit.sh | 12 +- t/t9815-git-p4-submit-fail.sh | 12 +- t/test-lib-functions.sh | 10 +- 225 files changed, 1196 insertions(+), 1194 deletions(-)
Signature · 1 line
2.42.0-530-g692be87cbb
PATCH 1/2 test framework: further deprecate test_i18ngrep
As an attempt to come up with a useful mechanism to ensure that certain messages are left untranslated [*], we earlier wrote GIT_TEST_GETTEXT_POISON off as a failed experiment.
But the output from the test helper was easier to use while debugging failed tests, compared to the same test writtein with the plain-vanilla "grep". Especially when a test that expects a certain string to appear in the output (e.g. "this test must fail with this message") fails, "grep message output" would just silently fail and in a &&-chained sequence of commands, it is hard to tell which step failed. test_i18ngrep explicitly said "we wanted to see a line that match this pattern but did not see a hit in this file".
What we have as test_i18ngrep in our tree still retains this verbose output (even though we got rid of the "poison" support). Let's rename it to test_grep (because it is no longer about i18n at all) and then make test_i18ngrep a thin wrapper around it. Existing callers of test_i18ngrep can be mechanically rewritten to instead use test_grep over time, but it does not have to be done in this commit.
[Footnote]
* The idea was that human-facing messages are often translated, but there are messages that should never be translated. We use "grep" only for the latter kind of messages, and then run tests in "poison" mode that spew garbage for translatable messages. If such a test run fails, it means these messages tested with "grep" were marked for translation by mistake. test_i18ngrep was to be used for other messages that are to be translated, and was to always "succeed" when runing under the "poison" mode.
--- t/test-lib-functions.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
t/test-lib-functions.sh +6 -4
@@ -1208,14 +1208,16 @@ test_cmp_bin () { cmp "$@" } -# Wrapper for grep which used to be used for -# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other -# in-flight changes. Should not be used and will be removed soon. +# Deprecated - do not use this in new code test_i18ngrep () { + test_grep "$@" +} + +test_grep () { eval "last_arg=\${$#}" test -f "$last_arg" || - BUG "test_i18ngrep requires a file to read as the last parameter" + BUG "test_grep requires a file to read as the last parameter" if test $# -lt 2 || { test "x!" = "x$1" && test $# -lt 3 ; }
Signature · 1 line
2.42.0-530-g692be87cbb
PATCH 2/2 tests: teach callers of test_i18ngrep to use test_grep
In reply to Junio C HamanoThey are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite test_i18ngrep to test_grep, there won't be any new bug, even if there still are callers of test_i18ngrep remaining in the tree, or when merged to other topics that add new uses of test_i18ngrep.
This patch was produced more or less with
git grep -l -e 'test_i18ngrep ' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /'
and a good way to sanity check the result yourself is to run the above in a checkout of c4603c1c (test framework: further deprecate test_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see that test_i18ngrep in a few t/lib-*.sh files corrected, in addition to the manual reproduction.
--- t/lib-httpd.sh | 2 +- t/lib-submodule-update.sh | 2 +- t/t0001-init.sh | 16 +-- t/t0002-gitfile.sh | 4 +- t/t0003-attributes.sh | 4 +- t/t0008-ignores.sh | 4 +- t/t0012-help.sh | 16 +-- t/t0013-sha1dc.sh | 2 +- t/t0014-alias.sh | 8 +- t/t0021-conversion.sh | 6 +- t/t0028-working-tree-encoding.sh | 32 ++--- t/t0040-parse-options.sh | 4 +- t/t0041-usage.sh | 32 ++--- t/t0061-run-command.sh | 6 +- t/t0070-fundamental.sh | 4 +- t/t0091-bugreport.sh | 2 +- t/t0300-credentials.sh | 2 +- t/t1060-object-corruption.sh | 2 +- t/t1091-sparse-checkout-builtin.sh | 68 ++++----- t/t1092-sparse-checkout-compatibility.sh | 6 +- t/t1300-config.sh | 44 +++--- t/t1307-config-blob.sh | 2 +- t/t1308-config-set.sh | 10 +- t/t1309-early-config.sh | 2 +- t/t1310-config-default.sh | 4 +- t/t1400-update-ref.sh | 22 +-- t/t1404-update-ref-errors.sh | 4 +- t/t1410-reflog.sh | 6 +- t/t1416-ref-transaction-hooks.sh | 2 +- t/t1430-bad-ref-name.sh | 22 +-- t/t1450-fsck.sh | 80 +++++------ t/t1506-rev-parse-diagnosis.sh | 34 ++--- t/t1512-rev-parse-disambiguation.sh | 6 +- t/t2004-checkout-cache-temp.sh | 2 +- t/t2006-checkout-index-basic.sh | 14 +- t/t2010-checkout-ambiguous.sh | 4 +- t/t2018-checkout-branch.sh | 4 +- t/t2019-checkout-ambiguous-ref.sh | 8 +- t/t2020-checkout-detach.sh | 8 +- t/t2024-checkout-dwim.sh | 8 +- t/t2025-checkout-no-overlay.sh | 2 +- t/t2026-checkout-pathspec-file.sh | 8 +- t/t2027-checkout-track.sh | 2 +- t/t2030-unresolve-info.sh | 2 +- t/t2072-restore-pathspec-file.sh | 8 +- t/t2106-update-index-assume-unchanged.sh | 2 +- t/t2107-update-index-basic.sh | 4 +- t/t2203-add-intent.sh | 6 +- t/t2204-add-ignored.sh | 8 +- t/t2401-worktree-prune.sh | 10 +- t/t2402-worktree-list.sh | 6 +- t/t2403-worktree-move.sh | 2 +- t/t2406-worktree-repair.sh | 24 ++-- t/t3004-ls-files-basic.sh | 4 +- t/t3007-ls-files-recurse-submodules.sh | 4 +- t/t3200-branch.sh | 18 +-- t/t3202-show-branch.sh | 2 +- t/t3206-range-diff.sh | 22 +-- t/t3210-pack-refs.sh | 2 +- t/t3301-notes.sh | 4 +- t/t3310-notes-merge-manual-resolve.sh | 16 +-- t/t3320-notes-merge-worktrees.sh | 4 +- t/t3321-notes-stripspace.sh | 2 +- t/t3400-rebase.sh | 6 +- t/t3402-rebase-merge.sh | 2 +- t/t3403-rebase-skip.sh | 30 ++-- t/t3404-rebase-interactive.sh | 38 ++--- t/t3406-rebase-message.sh | 18 +-- t/t3418-rebase-continue.sh | 6 +- t/t3431-rebase-fork-point.sh | 2 +- t/t3501-revert-cherry-pick.sh | 6 +- t/t3507-cherry-pick-conflict.sh | 8 +- t/t3510-cherry-pick-sequence.sh | 6 +- t/t3600-rm.sh | 8 +- t/t3601-rm-pathspec-file.sh | 6 +- t/t3700-add.sh | 6 +- t/t3701-add-interactive.sh | 8 +- t/t3704-add-pathspec-file.sh | 12 +- t/t3900-i18n-commit.sh | 8 +- t/t3901-i18n-patch.sh | 2 +- t/t3903-stash.sh | 10 +- t/t3905-stash-include-untracked.sh | 2 +- t/t3909-stash-pathspec-file.sh | 6 +- t/t4001-diff-rename.sh | 34 ++--- t/t4013-diff-various.sh | 2 +- t/t4014-format-patch.sh | 12 +- t/t4015-diff-whitespace.sh | 20 +-- t/t4018-diff-funcname.sh | 14 +- t/t4031-diff-rewrite-binary.sh | 2 +- t/t4047-diff-dirstat.sh | 22 +-- t/t4053-diff-no-index.sh | 2 +- t/t4055-diff-context.sh | 4 +- t/t4068-diff-symmetric-merge-base.sh | 28 ++-- t/t4115-apply-symlink.sh | 2 +- t/t4120-apply-popt.sh | 4 +- t/t4122-apply-symlink-inside.sh | 14 +- t/t4129-apply-samemode.sh | 4 +- t/t4133-apply-filenames.sh | 8 +- t/t4150-am.sh | 4 +- t/t4151-am-abort.sh | 2 +- t/t4153-am-resume-override-opts.sh | 2 +- t/t4200-rerere.sh | 4 +- t/t4201-shortlog.sh | 2 +- t/t4202-log.sh | 18 +-- t/t4203-mailmap.sh | 2 +- t/t4208-log-magic-pathspec.sh | 6 +- t/t4209-log-pickaxe.sh | 4 +- t/t4211-line-log.sh | 4 +- t/t4212-log-corrupt.sh | 2 +- t/t4256-am-format-flowed.sh | 2 +- t/t5300-pack-object.sh | 4 +- t/t5302-pack-index.sh | 4 +- t/t5304-prune.sh | 4 +- t/t5310-pack-bitmaps.sh | 8 +- t/t5318-commit-graph.sh | 18 +-- t/t5319-multi-pack-index.sh | 10 +- t/t5324-split-commit-graph.sh | 16 +-- t/t5331-pack-objects-stdin.sh | 4 +- t/t5411/test-0026-push-options.sh | 2 +- t/t5411/test-0027-push-options--porcelain.sh | 2 +- t/t5500-fetch-pack.sh | 10 +- t/t5504-fetch-receive-strict.sh | 26 ++-- t/t5505-remote.sh | 22 +-- t/t5510-fetch.sh | 8 +- t/t5512-ls-remote.sh | 2 +- t/t5514-fetch-multiple.sh | 4 +- t/t5516-fetch-push.sh | 8 +- t/t5520-pull.sh | 34 ++--- t/t5521-pull-options.sh | 2 +- t/t5523-push-upstream.sh | 12 +- t/t5528-push-default.sh | 2 +- t/t5530-upload-pack-error.sh | 4 +- t/t5531-deep-submodule-push.sh | 2 +- t/t5534-push-signed.sh | 6 +- t/t5536-fetch-conflicts.sh | 8 +- t/t5541-http-push-smart.sh | 20 +-- t/t5545-push-options.sh | 2 +- t/t5550-http-fetch-dumb.sh | 8 +- t/t5551-http-fetch-smart.sh | 4 +- t/t5570-git-daemon.sh | 10 +- t/t5572-pull-submodule.sh | 2 +- t/t5573-pull-verify-signatures.sh | 26 ++-- t/t5574-fetch-output.sh | 4 +- t/t5580-unc-paths.sh | 2 +- t/t5601-clone.sh | 6 +- t/t5604-clone-reference.sh | 2 +- t/t5606-clone-options.sh | 10 +- t/t5607-clone-bundle.sh | 4 +- t/t5611-clone-config.sh | 4 +- t/t5616-partial-clone.sh | 22 +-- t/t5701-git-serve.sh | 8 +- t/t5702-protocol-v2.sh | 34 ++--- t/t5703-upload-pack-ref-in-want.sh | 4 +- t/t5704-protocol-violations.sh | 4 +- t/t5801-remote-helpers.sh | 8 +- t/t5812-proto-disable-http.sh | 2 +- t/t6001-rev-list-graft.sh | 4 +- t/t6021-rev-list-exclude-hidden.sh | 4 +- t/t6030-bisect-porcelain.sh | 24 ++-- t/t6040-tracking-info.sh | 18 +-- t/t6050-replace.sh | 14 +- t/t6102-rev-list-unexpected-objects.sh | 16 +-- t/t6112-rev-list-filters-objects.sh | 2 +- t/t6120-describe.sh | 2 +- t/t6134-pathspec-in-submodule.sh | 2 +- t/t6135-pathspec-with-attrs.sh | 8 +- t/t6136-pathspec-in-bare.sh | 8 +- t/t6402-merge-rename.sh | 16 +-- t/t6422-merge-rename-corner-cases.sh | 16 +-- t/t6423-merge-rename-directories.sh | 140 +++++++++---------- t/t6424-merge-unrelated-index-changes.sh | 6 +- t/t6425-merge-rename-delete.sh | 4 +- t/t6426-merge-skip-unneeded-updates.sh | 2 +- t/t6430-merge-recursive.sh | 8 +- t/t6433-merge-toplevel.sh | 4 +- t/t6436-merge-overwrite.sh | 4 +- t/t6437-submodule-merge.sh | 2 +- t/t6500-gc.sh | 14 +- t/t7001-mv.sh | 4 +- t/t7105-reset-patch.sh | 6 +- t/t7106-reset-unborn-branch.sh | 2 +- t/t7107-reset-pathspec-file.sh | 10 +- t/t7110-reset-merge.sh | 6 +- t/t7201-co.sh | 4 +- t/t7300-clean.sh | 2 +- t/t7400-submodule-basic.sh | 64 ++++----- t/t7403-submodule-sync.sh | 4 +- t/t7406-submodule-update.sh | 6 +- t/t7411-submodule-config.sh | 4 +- t/t7414-submodule-mistakes.sh | 8 +- t/t7416-submodule-dash-url.sh | 4 +- t/t7417-submodule-path-url.sh | 4 +- t/t7450-bad-git-dotfiles.sh | 12 +- t/t7500-commit-template-squash-signoff.sh | 2 +- t/t7501-commit-basic-functionality.sh | 6 +- t/t7502-commit-porcelain.sh | 32 ++--- t/t7506-status-submodule.sh | 28 ++-- t/t7507-commit-verbose.sh | 4 +- t/t7508-status.sh | 24 ++-- t/t7509-commit-authorship.sh | 4 +- t/t7518-ident-corner-cases.sh | 10 +- t/t7519-status-fsmonitor.sh | 6 +- t/t7520-ignored-hook-warning.sh | 8 +- t/t7525-status-rename.sh | 54 +++---- t/t7526-commit-pathspec-file.sh | 14 +- t/t7600-merge.sh | 30 ++-- t/t7601-merge-pull-config.sh | 50 +++---- t/t7611-merge-abort.sh | 4 +- t/t7612-merge-verify-signatures.sh | 24 ++-- t/t7703-repack-geometric.sh | 4 +- t/t7800-difftool.sh | 4 +- t/t7810-grep.sh | 4 +- t/t7811-grep-open.sh | 2 +- t/t7814-grep-recurse-submodules.sh | 2 +- t/t7816-grep-binary-pattern.sh | 4 +- t/t7900-maintenance.sh | 24 ++-- t/t8003-blame-corner-cases.sh | 2 +- t/t8013-blame-ignore-revs.sh | 6 +- t/t9001-send-email.sh | 8 +- t/t9300-fast-import.sh | 26 ++-- t/t9800-git-p4-basic.sh | 18 +-- t/t9801-git-p4-branch.sh | 2 +- t/t9807-git-p4-submit.sh | 12 +- t/t9815-git-p4-submit-fail.sh | 12 +- 224 files changed, 1190 insertions(+), 1190 deletions(-)
t/lib-httpd.sh +1 -1
@@ -255,7 +255,7 @@ test_http_push_nonff () { ' test_expect_success 'non-fast-forward push shows help message' ' - test_i18ngrep "Updates were rejected because" output + test_grep "Updates were rejected because" output ' test_expect_${EXPECT_CAS_RESULT} 'force with lease aka cas' '
t/lib-submodule-update.sh +1 -1
@@ -830,7 +830,7 @@ test_submodule_recursing_with_args_common () { cd submodule_update && git branch -t invalid_sub1 origin/invalid_sub1 && test_must_fail $command invalid_sub1 2>err && - test_i18ngrep sub1 err && + test_grep sub1 err && test_superproject_content origin/add_sub1 && test_submodule_content sub1 origin/add_sub1 )
t/t0001-init.sh +8 -8
@@ -168,8 +168,8 @@ test_expect_success 'reinit' ' git -c init.defaultBranch=initial init >out1 2>err1 && git init >out2 2>err2 ) && - test_i18ngrep "Initialized empty" again/out1 && - test_i18ngrep "Reinitialized existing" again/out2 && + test_grep "Initialized empty" again/out1 && + test_grep "Reinitialized existing" again/out2 && test_must_be_empty again/err1 && test_must_be_empty again/err2 '
@@ -332,7 +332,7 @@ test_expect_success 'init with separate gitdir' ' test_expect_success 'explicit bare & --separate-git-dir incompatible' ' test_must_fail git init --bare --separate-git-dir goop.git bare.git 2>err && - test_i18ngrep "cannot be used together" err + test_grep "cannot be used together" err ' test_expect_success 'implicit bare & --separate-git-dir incompatible' '
@@ -340,7 +340,7 @@ test_expect_success 'implicit bare & --separate-git-dir incompatible' ' mkdir -p bare.git && test_must_fail env GIT_DIR=. \ git -C bare.git init --separate-git-dir goop.git 2>err && - test_i18ngrep "incompatible" err + test_grep "incompatible" err ' test_expect_success 'bare & --separate-git-dir incompatible within worktree' '
@@ -349,7 +349,7 @@ test_expect_success 'bare & --separate-git-dir incompatible within worktree' ' git clone --bare . bare.git && git -C bare.git worktree add --detach ../linkwt && test_must_fail git -C linkwt init --separate-git-dir seprepo 2>err && - test_i18ngrep "incompatible" err + test_grep "incompatible" err ' test_lazy_prereq GETCWD_IGNORES_PERMS '
@@ -563,7 +563,7 @@ test_expect_success '--initial-branch' ' : re-initializing should not change the branch name && git init --initial-branch=ignore initial-branch-option 2>err && - test_i18ngrep "ignored --initial-branch" err && + test_grep "ignored --initial-branch" err && git -C initial-branch-option symbolic-ref HEAD >actual && grep hello actual '
@@ -579,7 +579,7 @@ test_expect_success 'advice on unconfigured init.defaultBranch' ' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git -c color.advice=always \ init unconfigured-default-branch-name 2>err && test_decode_color <err >decoded && - test_i18ngrep "<YELLOW>hint: " decoded + test_grep "<YELLOW>hint: " decoded ' test_expect_success 'overridden default main branch name (env)' '
@@ -592,7 +592,7 @@ test_expect_success 'overridden default main branch name (env)' ' test_expect_success 'invalid default branch name' ' test_must_fail env GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME="with space" \ git init initial-branch-invalid 2>err && - test_i18ngrep "invalid branch name" err + test_grep "invalid branch name" err ' test_expect_success 'branch -m with the initial branch' '
t/t0002-gitfile.sh +2 -2
@@ -22,13 +22,13 @@ test_expect_success 'initial setup' ' test_expect_success 'bad setup: invalid .git file format' ' echo "gitdir $REAL" >.git && test_must_fail git rev-parse 2>.err && - test_i18ngrep "invalid gitfile format" .err + test_grep "invalid gitfile format" .err ' test_expect_success 'bad setup: invalid .git file path' ' echo "gitdir: $REAL.not" >.git && test_must_fail git rev-parse 2>.err && - test_i18ngrep "not a git repository" .err + test_grep "not a git repository" .err ' test_expect_success 'final setup + check rev-parse --git-dir' '
t/t0003-attributes.sh +2 -2
@@ -259,7 +259,7 @@ test_expect_success 'root subdir attribute test' ' test_expect_success 'negative patterns' ' echo "!f test=bar" >.gitattributes && git check-attr test -- '"'"'!f'"'"' 2>errors && - test_i18ngrep "Negative patterns are ignored" errors + test_grep "Negative patterns are ignored" errors ' test_expect_success 'patterns starting with exclamation' '
@@ -424,7 +424,7 @@ test_expect_success SYMLINKS 'symlinks not respected in-tree' ' mkdir subdir && ln -s ../attr subdir/.gitattributes && attr_check_basic subdir/file unspecified && - test_i18ngrep "unable to access.*gitattributes" err + test_grep "unable to access.*gitattributes" err ' test_expect_success 'large attributes line ignored in tree' '
t/t0008-ignores.sh +2 -2
@@ -49,7 +49,7 @@ broken_c_unquote_verbose () { stderr_contains () { regexp="$1" - if test_i18ngrep "$regexp" "$HOME/stderr" + if test_grep "$regexp" "$HOME/stderr" then return 0 else
@@ -942,7 +942,7 @@ test_expect_success SYMLINKS 'symlinks not respected in-tree' ' ln -s ignore subdir/.gitignore && test_must_fail git check-ignore subdir/file >actual 2>err && test_must_be_empty actual && - test_i18ngrep "unable to access.*gitignore" err + test_grep "unable to access.*gitignore" err ' test_done
t/t0012-help.sh +8 -8
@@ -100,17 +100,17 @@ test_expect_success "--help does not work for guides" " test_expect_success 'git help' ' git help >help.output && - test_i18ngrep "^ clone " help.output && - test_i18ngrep "^ add " help.output && - test_i18ngrep "^ log " help.output && - test_i18ngrep "^ commit " help.output && - test_i18ngrep "^ fetch " help.output + test_grep "^ clone " help.output && + test_grep "^ add " help.output && + test_grep "^ log " help.output && + test_grep "^ commit " help.output && + test_grep "^ fetch " help.output ' test_expect_success 'git help -g' ' git help -g >help.output && - test_i18ngrep "^ everyday " help.output && - test_i18ngrep "^ tutorial " help.output + test_grep "^ everyday " help.output && + test_grep "^ tutorial " help.output ' test_expect_success 'git help fails for non-existing html pages' '
@@ -257,7 +257,7 @@ do export GIT_CEILING_DIRECTORIES && test_expect_code 129 git -C sub $builtin -h >output 2>&1 ) && - test_i18ngrep usage output + test_grep usage output ' done <builtins
t/t0013-sha1dc.sh +1 -1
@@ -16,7 +16,7 @@ fi test_expect_success 'test-sha1 detects shattered pdf' ' test_must_fail test-tool sha1 <"$TEST_DATA/shattered-1.pdf" 2>err && - test_i18ngrep collision err && + test_grep collision err && grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err '
t/t0014-alias.sh +4 -4
@@ -8,7 +8,7 @@ test_expect_success 'nested aliases - internal execution' ' git config alias.nested-internal-1 nested-internal-2 && git config alias.nested-internal-2 status && git nested-internal-1 >output && - test_i18ngrep "^On branch " output + test_grep "^On branch " output ' test_expect_success 'nested aliases - mixed execution' '
@@ -16,7 +16,7 @@ test_expect_success 'nested aliases - mixed execution' ' git config alias.nested-external-2 "!git nested-external-3" && git config alias.nested-external-3 status && git nested-external-1 >output && - test_i18ngrep "^On branch " output + test_grep "^On branch " output ' test_expect_success 'looping aliases - internal execution' '
@@ -24,7 +24,7 @@ test_expect_success 'looping aliases - internal execution' ' git config alias.loop-internal-2 loop-internal-3 && git config alias.loop-internal-3 loop-internal-2 && test_must_fail git loop-internal-1 2>output && - test_i18ngrep "^fatal: alias loop detected: expansion of" output + test_grep "^fatal: alias loop detected: expansion of" output ' # This test is disabled until external loops are fixed, because would block
@@ -34,7 +34,7 @@ test_expect_success 'looping aliases - internal execution' ' # git config alias.loop-mixed-1 loop-mixed-2 && # git config alias.loop-mixed-2 "!git loop-mixed-1" && # test_must_fail git loop-mixed-1 2>output && -# test_i18ngrep "^fatal: alias loop detected: expansion of" output +# test_grep "^fatal: alias loop detected: expansion of" output #' test_expect_success 'run-command formats empty args properly' '
t/t0021-conversion.sh +3 -3
@@ -263,7 +263,7 @@ test_expect_success 'required filter with absent clean field' ' echo test >test.ac && test_must_fail git add test.ac 2>stderr && - test_i18ngrep "fatal: test.ac: clean filter .absentclean. failed" stderr + test_grep "fatal: test.ac: clean filter .absentclean. failed" stderr ' test_expect_success 'required filter with absent smudge field' '
@@ -276,7 +276,7 @@ test_expect_success 'required filter with absent smudge field' ' git add test.as && rm -f test.as && test_must_fail git checkout -- test.as 2>stderr && - test_i18ngrep "fatal: test.as: smudge filter absentsmudge failed" stderr + test_grep "fatal: test.as: smudge filter absentsmudge failed" stderr ' test_expect_success 'filtering large input to small output should use little memory' '
@@ -733,7 +733,7 @@ test_expect_success 'process filter should restart after unexpected write failur git checkout --quiet --no-progress . 2>git-stderr.log && grep "smudge write error" git-stderr.log && - test_i18ngrep "error: external filter" git-stderr.log && + test_grep "error: external filter" git-stderr.log && cat >expected.log <<-EOF && START
t/t0028-working-tree-encoding.sh +16 -16
@@ -92,23 +92,23 @@ do # In these cases the BOM is prohibited. cp bebom.utf${i}be.raw bebom.utf${i}be && test_must_fail git add bebom.utf${i}be 2>err.out && - test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out && - test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out && + test_grep "fatal: BOM is prohibited .* utf-${i}be" err.out && + test_grep "use UTF-${i} as working-tree-encoding" err.out && cp lebom.utf${i}le.raw lebom.utf${i}be && test_must_fail git add lebom.utf${i}be 2>err.out && - test_i18ngrep "fatal: BOM is prohibited .* utf-${i}be" err.out && - test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out && + test_grep "fatal: BOM is prohibited .* utf-${i}be" err.out && + test_grep "use UTF-${i} as working-tree-encoding" err.out && cp bebom.utf${i}be.raw bebom.utf${i}le && test_must_fail git add bebom.utf${i}le 2>err.out && - test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out && - test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out && + test_grep "fatal: BOM is prohibited .* utf-${i}LE" err.out && + test_grep "use UTF-${i} as working-tree-encoding" err.out && cp lebom.utf${i}le.raw lebom.utf${i}le && test_must_fail git add lebom.utf${i}le 2>err.out && - test_i18ngrep "fatal: BOM is prohibited .* utf-${i}LE" err.out && - test_i18ngrep "use UTF-${i} as working-tree-encoding" err.out + test_grep "fatal: BOM is prohibited .* utf-${i}LE" err.out && + test_grep "use UTF-${i} as working-tree-encoding" err.out ' test_expect_success "check required UTF-${i} BOM" '
@@ -118,13 +118,13 @@ do cp nobom.utf${i}be.raw nobom.utf${i} && test_must_fail git add nobom.utf${i} 2>err.out && - test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out && - test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out && + test_grep "fatal: BOM is required .* utf-${i}" err.out && + test_grep "use UTF-${i}BE or UTF-${i}LE" err.out && cp nobom.utf${i}le.raw nobom.utf${i} && test_must_fail git add nobom.utf${i} 2>err.out && - test_i18ngrep "fatal: BOM is required .* utf-${i}" err.out && - test_i18ngrep "use UTF-${i}BE or UTF-${i}LE" err.out + test_grep "fatal: BOM is required .* utf-${i}" err.out && + test_grep "use UTF-${i}BE or UTF-${i}LE" err.out ' test_expect_success "eol conversion for UTF-${i} encoded files on checkout" '
@@ -169,7 +169,7 @@ test_expect_success 'check unsupported encodings' ' echo "*.set text working-tree-encoding" >.gitattributes && printf "set" >t.set && test_must_fail git add t.set 2>err.out && - test_i18ngrep "true/false are no valid working-tree-encodings" err.out && + test_grep "true/false are no valid working-tree-encodings" err.out && echo "*.unset text -working-tree-encoding" >.gitattributes && printf "unset" >t.unset &&
@@ -182,7 +182,7 @@ test_expect_success 'check unsupported encodings' ' echo "*.garbage text working-tree-encoding=garbage" >.gitattributes && printf "garbage" >t.garbage && test_must_fail git add t.garbage 2>err.out && - test_i18ngrep "failed to encode" err.out + test_grep "failed to encode" err.out ' test_expect_success 'error if encoding round trip is not the same during refresh' '
@@ -201,7 +201,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh git update-ref refs/heads/main $COMMIT && test_must_fail git checkout HEAD^ 2>err.out && - test_i18ngrep "error: .* overwritten by checkout:" err.out + test_grep "error: .* overwritten by checkout:" err.out ' test_expect_success 'error if encoding garbage is already in Git' '
@@ -217,7 +217,7 @@ test_expect_success 'error if encoding garbage is already in Git' ' git update-ref refs/heads/main $COMMIT && git diff 2>err.out && - test_i18ngrep "error: BOM is required" err.out + test_grep "error: BOM is required" err.out ' test_lazy_prereq ICONV_SHIFT_JIS '
t/t0040-parse-options.sh +2 -2
@@ -366,13 +366,13 @@ test_expect_success 'OPT_CMDMODE() works' ' test_expect_success 'OPT_CMDMODE() detects incompatibility' ' test_must_fail test-tool parse-options --mode1 --mode2 >output 2>output.err && test_must_be_empty output && - test_i18ngrep "incompatible with --mode" output.err + test_grep "incompatible with --mode" output.err ' test_expect_success 'OPT_CMDMODE() detects incompatibility with something else' ' test_must_fail test-tool parse-options --set23 --mode2 >output 2>output.err && test_must_be_empty output && - test_i18ngrep "incompatible with something else" output.err + test_grep "incompatible with something else" output.err ' test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
t/t0041-usage.sh +16 -16
@@ -21,8 +21,8 @@ test_expect_success 'tag --contains <existent_tag>' ' test_expect_success 'tag --contains <inexistent_tag>' ' test_must_fail git tag --contains "notag" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'tag --no-contains <existent_tag>' '
@@ -34,27 +34,27 @@ test_expect_success 'tag --no-contains <existent_tag>' ' test_expect_success 'tag --no-contains <inexistent_tag>' ' test_must_fail git tag --no-contains "notag" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'tag usage error' ' test_must_fail git tag --noopt >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "usage" actual.err + test_grep "usage" actual.err ' test_expect_success 'branch --contains <existent_commit>' ' git branch --contains "main" >actual 2>actual.err && - test_i18ngrep "main" actual && + test_grep "main" actual && test_line_count = 0 actual.err ' test_expect_success 'branch --contains <inexistent_commit>' ' test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'branch --no-contains <existent_commit>' '
@@ -66,14 +66,14 @@ test_expect_success 'branch --no-contains <existent_commit>' ' test_expect_success 'branch --no-contains <inexistent_commit>' ' test_must_fail git branch --no-contains "nocommit" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'branch usage error' ' test_must_fail git branch --noopt >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "usage" actual.err + test_grep "usage" actual.err ' test_expect_success 'for-each-ref --contains <existent_object>' '
@@ -85,8 +85,8 @@ test_expect_success 'for-each-ref --contains <existent_object>' ' test_expect_success 'for-each-ref --contains <inexistent_object>' ' test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'for-each-ref --no-contains <existent_object>' '
@@ -98,14 +98,14 @@ test_expect_success 'for-each-ref --no-contains <existent_object>' ' test_expect_success 'for-each-ref --no-contains <inexistent_object>' ' test_must_fail git for-each-ref --no-contains "noobject" >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "error" actual.err && - test_i18ngrep ! "usage" actual.err + test_grep "error" actual.err && + test_grep ! "usage" actual.err ' test_expect_success 'for-each-ref usage error' ' test_must_fail git for-each-ref --noopt >actual 2>actual.err && test_line_count = 0 actual && - test_i18ngrep "usage" actual.err + test_grep "usage" actual.err ' test_done
t/t0061-run-command.sh +3 -3
@@ -19,12 +19,12 @@ test_expect_success MINGW 'subprocess inherits only std handles' ' test_expect_success 'start_command reports ENOENT (slash)' ' test-tool run-command start-command-ENOENT ./does-not-exist 2>err && - test_i18ngrep "\./does-not-exist" err + test_grep "\./does-not-exist" err ' test_expect_success 'start_command reports ENOENT (no slash)' ' test-tool run-command start-command-ENOENT does-not-exist 2>err && - test_i18ngrep "does-not-exist" err + test_grep "does-not-exist" err ' test_expect_success 'run_command can run a command' '
@@ -49,7 +49,7 @@ test_expect_success !RUNS_COMMANDS_FROM_PWD 'run_command is restricted to PATH' echo yikes EOF test_must_fail test-tool run-command run-command should-not-run 2>err && - test_i18ngrep "should-not-run" err + test_grep "should-not-run" err ' test_expect_success !MINGW 'run_command can run a script without a #! line' '
t/t0070-fundamental.sh +2 -2
@@ -44,13 +44,13 @@ test_expect_success 'incomplete sideband messages are reassembled' ' test_expect_success 'eof on sideband message is reported' ' printf 1234 >input && test-tool pkt-line receive-sideband <input 2>err && - test_i18ngrep "unexpected disconnect" err + test_grep "unexpected disconnect" err ' test_expect_success 'missing sideband designator is reported' ' printf 0004 >input && test-tool pkt-line receive-sideband <input 2>err && - test_i18ngrep "missing sideband" err + test_grep "missing sideband" err ' test_done
t/t0091-bugreport.sh +1 -1
@@ -65,7 +65,7 @@ test_expect_success '--output-directory puts the report in the provided dir' ' test_expect_success 'incorrect arguments abort with usage' ' test_must_fail git bugreport --false 2>output && - test_i18ngrep usage output && + test_grep usage output && test_path_is_missing git-bugreport-* '
t/t0300-credentials.sh +1 -1
@@ -827,7 +827,7 @@ test_expect_success 'credential config with partial URLs' ' git -c credential.$partial.helper=yep \ -c credential.with%0anewline.username=uh-oh \ credential fill <stdin 2>stderr && - test_i18ngrep "skipping credential lookup for key" stderr + test_grep "skipping credential lookup for key" stderr ' test_done
t/t1060-object-corruption.sh +1 -1
@@ -125,7 +125,7 @@ test_expect_success 'fetch into corrupted repo with index-pack' ' cd bit-error-cp && test_must_fail git -c transfer.unpackLimit=1 \ fetch ../no-bit-error 2>stderr && - test_i18ngrep ! -i collision stderr + test_grep ! -i collision stderr ) '
t/t1091-sparse-checkout-builtin.sh +34 -34
201 lines not on this page · raw message
t/t1092-sparse-checkout-compatibility.sh +3 -3
@@ -337,8 +337,8 @@ test_expect_success 'status reports sparse-checkout' ' init_repos && git -C sparse-checkout status >full && git -C sparse-index status >sparse && - test_i18ngrep "You are in a sparse checkout with " full && - test_i18ngrep "You are in a sparse checkout." sparse + test_grep "You are in a sparse checkout with " full && + test_grep "You are in a sparse checkout." sparse ' test_expect_success 'add, commit, checkout' '
@@ -1182,7 +1182,7 @@ test_expect_success 'checkout-index outside sparse definition' ' # Without --ignore-skip-worktree-bits, outside-of-cone files will trigger # an error test_sparse_match test_must_fail git checkout-index -- folder1/a && - test_i18ngrep "folder1/a has skip-worktree enabled" sparse-checkout-err && + test_grep "folder1/a has skip-worktree enabled" sparse-checkout-err && test_path_is_missing folder1/a && # With --ignore-skip-worktree-bits, outside-of-cone files are checked out
t/t1300-config.sh +22 -22
153 lines not on this page · raw message
t/t1307-config-blob.sh +1 -1
@@ -63,7 +63,7 @@ test_expect_success 'parse errors in blobs are properly attributed' ' git commit -m broken && test_must_fail git config --blob=HEAD:config some.value 2>err && - test_i18ngrep "HEAD:config" err + test_grep "HEAD:config" err ' test_expect_success 'can parse blob ending with CR' '
t/t1308-config-set.sh +5 -5
@@ -172,7 +172,7 @@ test_expect_success 'find string value for a key' ' test_expect_success 'check line error when NULL string is queried' ' test_expect_code 128 test-tool config get_string case.foo 2>result && - test_i18ngrep "fatal: .*case\.foo.*\.git/config.*line 7" result + test_grep "fatal: .*case\.foo.*\.git/config.*line 7" result ' test_expect_success 'find integer if value is non parse-able' '
@@ -342,14 +342,14 @@ test_expect_success 'check line errors for malformed values' ' br EOF test_expect_code 128 git br 2>result && - test_i18ngrep "missing value for .alias\.br" result && - test_i18ngrep "fatal: .*\.git/config" result && - test_i18ngrep "fatal: .*line 2" result + test_grep "missing value for .alias\.br" result && + test_grep "fatal: .*\.git/config" result && + test_grep "fatal: .*line 2" result ' test_expect_success 'error on modifying repo config without repo' ' nongit test_must_fail git config a.b c 2>err && - test_i18ngrep "not in a git directory" err + test_grep "not in a git directory" err ' cmdline_config="'foo.bar=from-cmdline'"
t/t1309-early-config.sh +1 -1
@@ -78,7 +78,7 @@ test_with_config () { test_expect_success 'ignore .git/ with incompatible repository version' ' test_with_config "[core]repositoryformatversion = 999999" 2>err && - test_i18ngrep "warning:.* Expected git repo version <= [1-9]" err + test_grep "warning:.* Expected git repo version <= [1-9]" err ' test_expect_failure 'ignore .git/ with invalid repository version' '
t/t1310-config-default.sh +2 -2
@@ -26,12 +26,12 @@ test_expect_success 'canonicalizes --default with appropriate type' ' test_expect_success 'dies when --default cannot be parsed' ' test_must_fail git config -f config --type=expiry-date --default=x --get \ not.a.section 2>error && - test_i18ngrep "failed to format default config value" error + test_grep "failed to format default config value" error ' test_expect_success 'does not allow --default without --get' ' test_must_fail git config --default=quux --unset a.section >output 2>&1 && - test_i18ngrep "\-\-default is only applicable to" output + test_grep "\-\-default is only applicable to" output ' test_done
t/t1400-update-ref.sh +11 -11
@@ -410,7 +410,7 @@ test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e && echo "$B" >expect && test_cmp expect o && - test_i18ngrep -F "warning: log for ref $m has gap after $gd" e + test_grep -F "warning: log for ref $m has gap after $gd" e ' test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' ' test_when_finished "rm -f o e" &&
@@ -431,7 +431,7 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' ' git rev-parse --verify "main@{2005-05-28}" >o 2>e && echo "$D" >expect && test_cmp expect o && - test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e + test_grep -F "warning: log for ref $m unexpectedly ended on $ld" e ' rm -f .git/$m .git/logs/$m expect
@@ -486,7 +486,7 @@ test_expect_success 'git cat-file blob main@{2005-05-26 23:42}:F (expect OTHER)' test_expect_success 'given old value for missing pseudoref, do not create' ' test_must_fail git update-ref PSEUDOREF $A $B 2>err && test_must_fail git rev-parse PSEUDOREF && - test_i18ngrep "unable to resolve reference" err + test_grep "unable to resolve reference" err ' test_expect_success 'create pseudoref' '
@@ -507,7 +507,7 @@ test_expect_success 'overwrite pseudoref with correct old value' ' test_expect_success 'do not overwrite pseudoref with wrong old value' ' test_must_fail git update-ref PSEUDOREF $D $E 2>err && test $C = $(git rev-parse PSEUDOREF) && - test_i18ngrep "cannot lock ref.*expected" err + test_grep "cannot lock ref.*expected" err ' test_expect_success 'delete pseudoref' '
@@ -519,7 +519,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' ' git update-ref PSEUDOREF $A && test_must_fail git update-ref -d PSEUDOREF $B 2>err && test $A = $(git rev-parse PSEUDOREF) && - test_i18ngrep "cannot lock ref.*expected" err + test_grep "cannot lock ref.*expected" err ' test_expect_success 'delete pseudoref with correct old value' '
@@ -536,7 +536,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' ' test_when_finished git update-ref -d PSEUDOREF && test_must_fail git update-ref PSEUDOREF $B $Z 2>err && test $A = $(git rev-parse PSEUDOREF) && - test_i18ngrep "already exists" err + test_grep "already exists" err ' # Test --stdin
@@ -556,7 +556,7 @@ test_expect_success 'stdin test setup' ' test_expect_success '-z fails without --stdin' ' test_must_fail git update-ref -z $m $m $m 2>err && - test_i18ngrep "usage: git update-ref" err + test_grep "usage: git update-ref" err ' test_expect_success 'stdin works with no input' '
@@ -674,7 +674,7 @@ test_expect_success 'stdin fails with duplicate refs' ' create $a $m EOF test_must_fail git update-ref --stdin <stdin 2>err && - test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err + test_grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin create ref works' '
@@ -1107,7 +1107,7 @@ test_expect_success 'stdin -z fails option with unknown name' ' test_expect_success 'stdin -z fails with duplicate refs' ' printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin && test_must_fail git update-ref -z --stdin <stdin 2>err && - test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err + test_grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin -z create ref works' '
@@ -1338,7 +1338,7 @@ test_expect_success 'fails with duplicate HEAD update' ' update HEAD $B EOF test_must_fail git update-ref --stdin <stdin 2>err && - test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err && + test_grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err && echo "refs/heads/target1" >expect && git symbolic-ref HEAD >actual && test_cmp expect actual &&
@@ -1355,7 +1355,7 @@ test_expect_success 'fails with duplicate ref update via symref' ' update refs/heads/symref2 $B EOF test_must_fail git update-ref --stdin <stdin 2>err && - test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err && + test_grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err && echo "refs/heads/target2" >expect && git symbolic-ref refs/heads/symref2 >actual && test_cmp expect actual &&
t/t1404-update-ref-errors.sh +2 -2
@@ -29,7 +29,7 @@ test_update_rejected () { fi && printf "create $prefix/%s $C\n" $create >input && test_must_fail git update-ref --stdin <input 2>output.err && - test_i18ngrep -F "$error" output.err && + test_grep -F "$error" output.err && git for-each-ref $prefix >actual && test_cmp unchanged actual }
@@ -613,7 +613,7 @@ test_expect_success REFFILES 'delete fails cleanly if packed-refs file is locked test_when_finished "rm -f .git/packed-refs.lock" && test_must_fail git update-ref -d $prefix/foo >out 2>err && git for-each-ref $prefix >actual && - test_i18ngrep "Unable to create $SQ.*packed-refs.lock$SQ: " err && + test_grep "Unable to create $SQ.*packed-refs.lock$SQ: " err && test_cmp unchanged actual '
t/t1410-reflog.sh +3 -3
@@ -29,7 +29,7 @@ check_fsck () { '') test_must_be_empty fsck.output ;; *) - test_i18ngrep "$1" fsck.output ;; + test_grep "$1" fsck.output ;; esac }
@@ -308,9 +308,9 @@ test_expect_success 'git reflog expire unknown reference' ' test_config gc.reflogexpireunreachable never && test_must_fail git reflog expire main@{123} 2>stderr && - test_i18ngrep "points nowhere" stderr && + test_grep "points nowhere" stderr && test_must_fail git reflog expire does-not-exist 2>stderr && - test_i18ngrep "points nowhere" stderr + test_grep "points nowhere" stderr ' test_expect_success 'checkout should not delete log for packed ref' '
t/t1416-ref-transaction-hooks.sh +1 -1
@@ -37,7 +37,7 @@ test_expect_success 'hook aborts updating ref in prepared state' ' fi EOF test_must_fail git update-ref HEAD POST 2>err && - test_i18ngrep "ref updates aborted by hook" err + test_grep "ref updates aborted by hook" err ' test_expect_success 'hook gets all queued updates in prepared state' '
t/t1430-bad-ref-name.sh +11 -11
@@ -47,7 +47,7 @@ test_expect_success 'git branch shows badly named ref as warning' ' test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" && git branch >output 2>error && - test_i18ngrep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error && + test_grep -e "ignoring ref with broken name refs/heads/broken\.\.\.ref" error && ! grep -e "broken\.\.\.ref" output '
@@ -158,7 +158,7 @@ test_expect_success 'rev-parse skips symref pointing to broken name' ' git rev-parse --verify one >expect && git rev-parse --verify shadow >actual 2>err && test_cmp expect actual && - test_i18ngrep "ignoring dangling symref refs/tags/shadow" err + test_grep "ignoring dangling symref refs/tags/shadow" err ' test_expect_success 'for-each-ref emits warnings for broken names' '
@@ -172,9 +172,9 @@ test_expect_success 'for-each-ref emits warnings for broken names' ' ! grep -e "broken\.\.\.ref" output && ! grep -e "badname" output && ! grep -e "broken\.\.\.symref" output && - test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error && - test_i18ngrep ! "ignoring broken ref refs/heads/badname" error && - test_i18ngrep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error + test_grep "ignoring ref with broken name refs/heads/broken\.\.\.ref" error && + test_grep ! "ignoring broken ref refs/heads/badname" error && + test_grep "ignoring ref with broken name refs/heads/broken\.\.\.symref" error ' test_expect_success 'update-ref -d can delete broken name' '
@@ -192,7 +192,7 @@ test_expect_success 'branch -d can delete broken name' ' test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" && git branch -d broken...ref >output 2>error && - test_i18ngrep "Deleted branch broken...ref (was broken)" output && + test_grep "Deleted branch broken...ref (was broken)" output && test_must_be_empty error && git branch >output 2>error && ! grep -e "broken\.\.\.ref" error &&
@@ -218,7 +218,7 @@ test_expect_success 'branch -d can delete symref to broken name' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" && git branch -d badname >output 2>error && test_path_is_missing .git/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 '
@@ -236,7 +236,7 @@ test_expect_success 'branch -d can delete dangling symref to broken name' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" && git branch -d badname >output 2>error && test_path_is_missing .git/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 '
@@ -265,7 +265,7 @@ test_expect_success 'branch -d can delete symref with broken name' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git branch -d broken...symref >output 2>error && test_path_is_missing .git/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 '
@@ -283,7 +283,7 @@ test_expect_success 'branch -d can delete dangling symref with broken name' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git branch -d broken...symref >output 2>error && test_path_is_missing .git/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 '
@@ -292,7 +292,7 @@ test_expect_success 'update-ref -d cannot delete non-ref in .git dir' ' echo precious >expect && test_must_fail git update-ref -d my-private-file >output 2>error && test_must_be_empty output && - test_i18ngrep -e "refusing to update ref with bad name" error && + test_grep -e "refusing to update ref with bad name" error && test_cmp expect .git/my-private-file '
t/t1450-fsck.sh +40 -40
281 lines not on this page · raw message
t/t1506-rev-parse-diagnosis.sh +17 -17
@@ -107,16 +107,16 @@ 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 && + test_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 + test_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 && + test_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 && + test_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 )
@@ -124,9 +124,9 @@ test_expect_success 'incorrect file in sha1:path' ' 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 && + test_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 && + test_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 &&
@@ -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 + test_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 && + test_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 + test_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 + test_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 + test_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 + test_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 && + test_grep ! "exists on disk" error && + test_grep "no such path in the working tree" error && cat >expect <<-\EOF && file.txt HEAD:file.txt
@@ -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 + test_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 + test_grep "bad revision" stderr ' test_expect_success 'arg before dashdash must be a revision (ambiguous)' '
@@ -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 + test_grep bad.revision.*--not-real err ' test_expect_success 'end-of-options still allows --' '
t/t1512-rev-parse-disambiguation.sh +3 -3
@@ -129,7 +129,7 @@ test_expect_success 'blob and tree' ' test_expect_success 'warn ambiguity when no candidate matches type hint' ' test_must_fail git rev-parse --verify 000000000^{commit} 2>actual && - test_i18ngrep "short object ID 000000000 is ambiguous" actual + test_grep "short object ID 000000000 is ambiguous" actual ' test_expect_success 'disambiguate tree-ish' '
@@ -470,10 +470,10 @@ test_expect_success 'cat-file --batch and --batch-check show ambiguous' ' echo "0000 ambiguous" >expect && echo 0000 | git cat-file --batch-check >actual 2>err && test_cmp expect actual && - test_i18ngrep hint: err && + test_grep hint: err && echo 0000 | git cat-file --batch >actual 2>err && test_cmp expect actual && - test_i18ngrep hint: err + test_grep hint: err ' test_done
t/t2004-checkout-cache-temp.sh +1 -1
@@ -93,7 +93,7 @@ test_expect_success 'checkout all stages of unknown path' ' rm -f path* .merge_* actual && test_must_fail git checkout-index --stage=all --temp \ -- does-not-exist 2>stderr && - test_i18ngrep not.in.the.cache stderr + test_grep not.in.the.cache stderr ' test_expect_success 'checkout all stages/one file to nothing' '
t/t2006-checkout-index-basic.sh +7 -7
@@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true test_expect_success 'checkout-index --gobbledegook' ' test_expect_code 129 git checkout-index --gobbledegook 2>err && - test_i18ngrep "[Uu]sage" err + test_grep "[Uu]sage" err ' test_expect_success 'checkout-index -h in broken repository' '
@@ -19,18 +19,18 @@ test_expect_success 'checkout-index -h in broken repository' ' >.git/index && test_expect_code 129 git checkout-index -h >usage 2>&1 ) && - test_i18ngrep "[Uu]sage" broken/usage + test_grep "[Uu]sage" broken/usage ' test_expect_success 'checkout-index reports errors (cmdline)' ' test_must_fail git checkout-index -- does-not-exist 2>stderr && - test_i18ngrep not.in.the.cache stderr + test_grep not.in.the.cache stderr ' test_expect_success 'checkout-index reports errors (stdin)' ' echo does-not-exist | test_must_fail git checkout-index --stdin 2>stderr && - test_i18ngrep not.in.the.cache stderr + test_grep not.in.the.cache stderr ' for mode in 'case' 'utf-8' do
@@ -88,8 +88,8 @@ test_expect_success 'checkout-index --temp correctly reports error on missing bl git update-index --index-info <objs && test_must_fail git checkout-index --temp symlink file 2>stderr && - test_i18ngrep "unable to read sha1 file of file ($missing_blob)" stderr && - test_i18ngrep "unable to read sha1 file of symlink ($missing_blob)" stderr + test_grep "unable to read sha1 file of file ($missing_blob)" stderr && + test_grep "unable to read sha1 file of symlink ($missing_blob)" stderr ' test_expect_success 'checkout-index --temp correctly reports error for submodules' '
@@ -98,7 +98,7 @@ test_expect_success 'checkout-index --temp correctly reports error for submodule git submodule add ./sub && git commit -m sub && test_must_fail git checkout-index --temp sub 2>stderr && - test_i18ngrep "cannot create temporary submodule sub" stderr + test_grep "cannot create temporary submodule sub" stderr ' test_done
t/t2010-checkout-ambiguous.sh +2 -2
@@ -62,8 +62,8 @@ test_expect_success 'disambiguate checking out from a tree-ish' ' test_expect_success 'accurate error message with more than one ref' ' test_must_fail git checkout HEAD main -- 2>actual && - test_i18ngrep 2 actual && - test_i18ngrep "one reference expected, 2 given" actual + test_grep 2 actual && + test_grep "one reference expected, 2 given" actual ' test_done
t/t2018-checkout-branch.sh +2 -2
@@ -278,12 +278,12 @@ test_expect_success 'checkout -b to a new branch preserves mergeable changes des test_expect_success 'checkout -b rejects an invalid start point' ' test_must_fail git checkout -b branch4 file1 2>err && - test_i18ngrep "is not a commit" err + test_grep "is not a commit" err ' test_expect_success 'checkout -b rejects an extra path argument' ' test_must_fail git checkout -b branch5 branch1 file1 2>err && - test_i18ngrep "Cannot update paths and switch to branch" err + test_grep "Cannot update paths and switch to branch" err ' test_done
t/t2019-checkout-ambiguous-ref.sh +4 -4
@@ -32,8 +32,8 @@ test_expect_success 'checkout chooses branch over tag' ' ' test_expect_success 'checkout reports switch to branch' ' - test_i18ngrep "Switched to branch" stderr && - test_i18ngrep ! "^HEAD is now at" stderr + test_grep "Switched to branch" stderr && + test_grep ! "^HEAD is now at" stderr ' test_expect_success 'checkout vague ref succeeds' '
@@ -54,8 +54,8 @@ test_expect_success VAGUENESS_SUCCESS 'checkout chooses branch over tag' ' ' test_expect_success VAGUENESS_SUCCESS 'checkout reports switch to branch' ' - test_i18ngrep "Switched to branch" stderr && - test_i18ngrep ! "^HEAD is now at" stderr + test_grep "Switched to branch" stderr && + test_grep ! "^HEAD is now at" stderr ' test_done
t/t2020-checkout-detach.sh +4 -4
@@ -17,12 +17,12 @@ check_not_detached () { PREV_HEAD_DESC='Previous HEAD position was' check_orphan_warning() { - test_i18ngrep "you are leaving $2 behind" "$1" && - test_i18ngrep ! "$PREV_HEAD_DESC" "$1" + test_grep "you are leaving $2 behind" "$1" && + test_grep ! "$PREV_HEAD_DESC" "$1" } check_no_orphan_warning() { - test_i18ngrep ! "you are leaving .* commit.*behind" "$1" && - test_i18ngrep "$PREV_HEAD_DESC" "$1" + test_grep ! "you are leaving .* commit.*behind" "$1" && + test_grep "$PREV_HEAD_DESC" "$1" } reset () {
t/t2024-checkout-dwim.sh +4 -4
@@ -93,7 +93,7 @@ test_expect_success 'when arg matches multiple remotes, do not fallback to inter test_must_fail git checkout ambiguous_branch_and_file 2>err && - test_i18ngrep "matched multiple (2) remote tracking branches" err && + test_grep "matched multiple (2) remote tracking branches" err && # file must not be altered test_cmp expect ambiguous_branch_and_file
@@ -105,12 +105,12 @@ test_expect_success 'checkout of branch from multiple remotes fails with advice' test_must_fail git checkout foo 2>stderr && test_branch main && status_uno_is_clean && - test_i18ngrep "^hint: " stderr && + test_grep "^hint: " stderr && test_must_fail git -c advice.checkoutAmbiguousRemoteBranchName=false \ checkout foo 2>stderr && test_branch main && status_uno_is_clean && - test_i18ngrep ! "^hint: " stderr + test_grep ! "^hint: " stderr ' test_expect_success PERL 'checkout -p with multiple remotes does not print advice' '
@@ -118,7 +118,7 @@ test_expect_success PERL 'checkout -p with multiple remotes does not print advic test_might_fail git branch -D foo && git checkout -p foo 2>stderr && - test_i18ngrep ! "^hint: " stderr && + test_grep ! "^hint: " stderr && status_uno_is_clean '
t/t2025-checkout-no-overlay.sh +1 -1
@@ -26,7 +26,7 @@ test_expect_success 'checkout --no-overlay removing last file from directory' ' test_expect_success 'checkout -p --overlay is disallowed' ' test_must_fail git checkout -p --overlay HEAD 2>actual && - test_i18ngrep "fatal: options .-p. and .--overlay. cannot be used together" actual + test_grep "fatal: options .-p. and .--overlay. cannot be used together" actual ' test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '
t/t2026-checkout-pathspec-file.sh +4 -4
@@ -149,16 +149,16 @@ test_expect_success 'error conditions' ' echo fileA.t >list && test_must_fail git checkout --pathspec-from-file=list --detach 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--detach. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--detach. cannot be used together" err && test_must_fail git checkout --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && test_must_fail git checkout --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && test_must_fail git checkout --pathspec-file-nul 2>err && - test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err ' test_done
t/t2027-checkout-track.sh +1 -1
@@ -22,7 +22,7 @@ test_expect_success 'checkout --track -b creates a new tracking branch' ' test_expect_success 'checkout --track -b rejects an extra path argument' ' test_must_fail git checkout --track -b branch2 main one.t 2>err && - test_i18ngrep "cannot be used with updating paths" err + test_grep "cannot be used with updating paths" err ' test_expect_success 'checkout --track -b overrides autoSetupMerge=inherit' '
t/t2030-unresolve-info.sh +1 -1
@@ -191,7 +191,7 @@ test_expect_success 'rerere forget (add-add conflict)' ' git commit -m "add differently" && test_must_fail git merge fifth && git rerere forget add-differently 2>actual && - test_i18ngrep "no remembered" actual + test_grep "no remembered" actual ' test_expect_success 'resolve-undo keeps blobs from gc' '
t/t2072-restore-pathspec-file.sh +4 -4
@@ -152,16 +152,16 @@ test_expect_success 'error conditions' ' >empty_list && test_must_fail git restore --pathspec-from-file=list --patch --source=HEAD^1 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && test_must_fail git restore --pathspec-from-file=list --source=HEAD^1 -- fileA.t 2>err && - test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err && - test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err && - test_i18ngrep -e "you must specify path(s) to restore" err + test_grep -e "you must specify path(s) to restore" err ' test_expect_success 'wildcard pathspec matches file in subdirectory' '
t/t2106-update-index-assume-unchanged.sh +1 -1
@@ -22,7 +22,7 @@ test_expect_success 'do not switch branches with dirty file' ' echo dirt >file && git update-index --assume-unchanged file && test_must_fail git checkout - 2>err && - test_i18ngrep overwritten err + test_grep overwritten err ' test_done
t/t2107-update-index-basic.sh +2 -2
@@ -14,7 +14,7 @@ test_expect_success 'update-index --nonsense fails' ' test_expect_success 'update-index --nonsense dumps usage' ' test_expect_code 129 git update-index --nonsense 2>err && - test_i18ngrep "[Uu]sage: git update-index" err + test_grep "[Uu]sage: git update-index" err ' test_expect_success 'update-index -h with corrupt index' '
@@ -25,7 +25,7 @@ test_expect_success 'update-index -h with corrupt index' ' >.git/index && test_expect_code 129 git update-index -h >usage 2>&1 ) && - test_i18ngrep "[Uu]sage: git update-index" broken/usage + test_grep "[Uu]sage: git update-index" broken/usage ' test_expect_success '--cacheinfo complains of missing arguments' '
t/t2203-add-intent.sh +3 -3
@@ -173,7 +173,7 @@ test_expect_success 'rename detection finds the right names' ' git add -N third && git status | grep -v "^?" >actual.1 && - test_i18ngrep "renamed: *first -> third" actual.1 && + test_grep "renamed: *first -> third" actual.1 && git status --porcelain | grep -v "^?" >actual.2 && cat >expected.2 <<-\EOF &&
@@ -213,8 +213,8 @@ test_expect_success 'double rename detection in status' ' git add -N third && git status | grep -v "^?" >actual.1 && - test_i18ngrep "renamed: *first -> second" actual.1 && - test_i18ngrep "renamed: *second -> third" actual.1 && + test_grep "renamed: *first -> second" actual.1 && + test_grep "renamed: *second -> third" actual.1 && git status --porcelain | grep -v "^?" >actual.2 && cat >expected.2 <<-\EOF &&
t/t2204-add-ignored.sh +4 -4
@@ -36,7 +36,7 @@ do ' test_expect_success "complaints for ignored $i output" ' - test_i18ngrep -e "Use -f if" err + test_grep -e "Use -f if" err ' test_expect_success "complaints for ignored $i with unignored file" '
@@ -46,7 +46,7 @@ do test_must_be_empty out ' test_expect_success "complaints for ignored $i with unignored file output" ' - test_i18ngrep -e "Use -f if" err + test_grep -e "Use -f if" err ' done
@@ -65,7 +65,7 @@ do test_expect_success "complaints for ignored $i in dir output" ' ( cd dir && - test_i18ngrep -e "Use -f if" err + test_grep -e "Use -f if" err ) ' done
@@ -85,7 +85,7 @@ do test_expect_success "complaints for ignored $i in sub output" ' ( cd sub && - test_i18ngrep -e "Use -f if" err + test_grep -e "Use -f if" err ) ' done
t/t2401-worktree-prune.sh +5 -5
@@ -47,7 +47,7 @@ test_expect_success SANITY 'prune directories with unreadable gitdir' ' : >.git/worktrees/def/gitdir && chmod u-r .git/worktrees/def/gitdir && git worktree prune --verbose 2>actual && - test_i18ngrep "Removing worktrees/def: unable to read gitdir file" actual && + test_grep "Removing worktrees/def: unable to read gitdir file" actual && ! test -d .git/worktrees/def && ! test -d .git/worktrees '
@@ -57,7 +57,7 @@ test_expect_success 'prune directories with invalid gitdir' ' : >.git/worktrees/def/def && : >.git/worktrees/def/gitdir && git worktree prune --verbose 2>actual && - test_i18ngrep "Removing worktrees/def: invalid gitdir file" actual && + test_grep "Removing worktrees/def: invalid gitdir file" actual && ! test -d .git/worktrees/def && ! test -d .git/worktrees '
@@ -67,7 +67,7 @@ test_expect_success 'prune directories with gitdir pointing to nowhere' ' : >.git/worktrees/def/def && echo "$(pwd)"/nowhere >.git/worktrees/def/gitdir && git worktree prune --verbose 2>actual && - test_i18ngrep "Removing worktrees/def: gitdir file points to non-existent location" actual && + test_grep "Removing worktrees/def: gitdir file points to non-existent location" actual && ! test -d .git/worktrees/def && ! test -d .git/worktrees '
@@ -103,7 +103,7 @@ test_expect_success 'prune duplicate (linked/linked)' ' sed "s/w2/w1/" .git/worktrees/w2/gitdir >.git/worktrees/w2/gitdir.new && mv .git/worktrees/w2/gitdir.new .git/worktrees/w2/gitdir && git worktree prune --verbose 2>actual && - test_i18ngrep "duplicate entry" actual && + test_grep "duplicate entry" actual && test -d .git/worktrees/w1 && ! test -d .git/worktrees/w2 '
@@ -116,7 +116,7 @@ test_expect_success 'prune duplicate (main/linked)' ' rm -fr wt && mv repo wt && git -C wt worktree prune --verbose 2>actual && - test_i18ngrep "duplicate entry" actual && + test_grep "duplicate entry" actual && ! test -d .git/worktrees/wt '
t/t2402-worktree-list.sh +3 -3
@@ -143,7 +143,7 @@ test_expect_success '"list" all worktrees --porcelain with prunable' ' rm -rf prunable && git worktree list --porcelain >out && sed -n "/^worktree .*\/prunable$/,/^$/p" <out >only_prunable && - test_i18ngrep "^prunable gitdir file points to non-existent location$" only_prunable + test_grep "^prunable gitdir file points to non-existent location$" only_prunable ' test_expect_success '"list" all worktrees with prunable consistent with "prune"' '
@@ -155,8 +155,8 @@ test_expect_success '"list" all worktrees with prunable consistent with "prune"' grep "/prunable *[0-9a-f].* prunable$" out && ! grep "/unprunable *[0-9a-f].* unprunable$" out && git worktree prune --verbose 2>out && - test_i18ngrep "^Removing worktrees/prunable" out && - test_i18ngrep ! "^Removing worktrees/unprunable" out + test_grep "^Removing worktrees/prunable" out && + test_grep ! "^Removing worktrees/unprunable" out ' test_expect_success '"list" --verbose and --porcelain mutually exclusive' '
t/t2403-worktree-move.sh +1 -1
@@ -202,7 +202,7 @@ test_expect_success 'proper error when worktree not found' ' for i in noodle noodle/bork do test_must_fail git worktree lock $i 2>err && - test_i18ngrep "not a working tree" err || return 1 + test_grep "not a working tree" err || return 1 done '
t/t2406-worktree-repair.sh +12 -12
@@ -25,7 +25,7 @@ test_expect_success 'worktree path not directory' ' >notdir && test_must_fail git worktree repair >out 2>err && test_must_be_empty out && - test_i18ngrep "not a directory" err + test_grep "not a directory" err ' test_expect_success "don't clobber .git repo" '
@@ -35,7 +35,7 @@ test_expect_success "don't clobber .git repo" ' test_create_repo repo && test_must_fail git worktree repair >out 2>err && test_must_be_empty out && - test_i18ngrep ".git is not a file" err + test_grep ".git is not a file" err ' test_corrupt_gitfile () {
@@ -47,7 +47,7 @@ test_corrupt_gitfile () { git -C corrupt rev-parse --absolute-git-dir >expect && eval "$butcher" && git -C "$repairdir" worktree repair 2>err && - test_i18ngrep "$problem" err && + test_grep "$problem" err && git -C corrupt rev-parse --absolute-git-dir >actual && test_cmp expect actual }
@@ -93,7 +93,7 @@ test_expect_success 'repair .git file from bare.git' ' test_expect_success 'invalid worktree path' ' test_must_fail git worktree repair /notvalid >out 2>err && test_must_be_empty out && - test_i18ngrep "not a valid path" err + test_grep "not a valid path" err ' test_expect_success 'repo not found; .git not file' '
@@ -101,7 +101,7 @@ test_expect_success 'repo not found; .git not file' ' test_create_repo not-a-worktree && test_must_fail git worktree repair not-a-worktree >out 2>err && test_must_be_empty out && - test_i18ngrep ".git is not a file" err + test_grep ".git is not a file" err ' test_expect_success 'repo not found; .git not referencing repo' '
@@ -111,7 +111,7 @@ test_expect_success 'repo not found; .git not referencing repo' ' mv side/.newgit side/.git && mkdir not-a-repo && test_must_fail git worktree repair side 2>err && - test_i18ngrep ".git file does not reference a repository" err + test_grep ".git file does not reference a repository" err ' test_expect_success 'repo not found; .git file broken' '
@@ -121,7 +121,7 @@ test_expect_success 'repo not found; .git file broken' ' mv orig moved && test_must_fail git worktree repair moved >out 2>err && test_must_be_empty out && - test_i18ngrep ".git file broken" err + test_grep ".git file broken" err ' test_expect_success 'repair broken gitdir' '
@@ -132,7 +132,7 @@ test_expect_success 'repair broken gitdir' ' mv orig moved && git worktree repair moved 2>err && test_cmp expect .git/worktrees/orig/gitdir && - test_i18ngrep "gitdir unreadable" err + test_grep "gitdir unreadable" err ' test_expect_success 'repair incorrect gitdir' '
@@ -142,7 +142,7 @@ test_expect_success 'repair incorrect gitdir' ' mv orig moved && git worktree repair moved 2>err && test_cmp expect .git/worktrees/orig/gitdir && - test_i18ngrep "gitdir incorrect" err + test_grep "gitdir incorrect" err ' test_expect_success 'repair gitdir (implicit) from linked worktree' '
@@ -152,7 +152,7 @@ test_expect_success 'repair gitdir (implicit) from linked worktree' ' mv orig moved && git -C moved worktree repair 2>err && test_cmp expect .git/worktrees/orig/gitdir && - test_i18ngrep "gitdir incorrect" err + test_grep "gitdir incorrect" err ' test_expect_success 'unable to repair gitdir (implicit) from main worktree' '
@@ -177,8 +177,8 @@ test_expect_success 'repair multiple gitdir files' ' git worktree repair moved1 moved2 2>err && test_cmp expect1 .git/worktrees/orig1/gitdir && test_cmp expect2 .git/worktrees/orig2/gitdir && - test_i18ngrep "gitdir incorrect:.*orig1/gitdir$" err && - test_i18ngrep "gitdir incorrect:.*orig2/gitdir$" err + test_grep "gitdir incorrect:.*orig1/gitdir$" err && + test_grep "gitdir incorrect:.*orig2/gitdir$" err ' test_expect_success 'repair moved main and linked worktrees' '
t/t3004-ls-files-basic.sh +2 -2
@@ -21,7 +21,7 @@ test_expect_success 'ls-files with nonexistent path' ' test_expect_success 'ls-files with nonsense option' ' test_expect_code 129 git ls-files --nonsense 2>actual && - test_i18ngrep "[Uu]sage: git ls-files" actual + test_grep "[Uu]sage: git ls-files" actual ' test_expect_success 'ls-files -h in corrupt repository' '
@@ -32,7 +32,7 @@ test_expect_success 'ls-files -h in corrupt repository' ' >.git/index && test_expect_code 129 git ls-files -h >usage 2>&1 ) && - test_i18ngrep "[Uu]sage: git ls-files " broken/usage + test_grep "[Uu]sage: git ls-files " broken/usage ' test_expect_success SYMLINKS 'ls-files with absolute paths to symlinks' '
t/t3007-ls-files-recurse-submodules.sh +2 -2
@@ -296,7 +296,7 @@ test_expect_success '--recurse-submodules and relative paths' ' test_expect_success '--recurse-submodules does not support --error-unmatch' ' test_must_fail git ls-files --recurse-submodules --error-unmatch 2>actual && - test_i18ngrep "does not support --error-unmatch" actual + test_grep "does not support --error-unmatch" actual ' test_expect_success '--recurse-submodules parses submodule repo config' '
@@ -335,7 +335,7 @@ test_expect_success '--recurse-submodules submodules ignore super project worktr test_incompatible_with_recurse_submodules () { test_expect_success "--recurse-submodules and $1 are incompatible" " test_must_fail git ls-files --recurse-submodules $1 2>actual && - test_i18ngrep 'unsupported mode' actual + test_grep 'unsupported mode' actual " }
t/t3200-branch.sh +9 -9
@@ -36,7 +36,7 @@ test_expect_success 'branch -h in broken repository' ' >.git/refs/heads/main && test_expect_code 129 git branch -h >usage 2>&1 ) && - test_i18ngrep "[Uu]sage" broken/usage + test_grep "[Uu]sage" broken/usage ' test_expect_success 'git branch abc should create a branch' '
@@ -103,7 +103,7 @@ test_expect_success 'git branch l should work after branch l/m has been deleted' test_expect_success 'git branch -m dumps usage' ' test_expect_code 128 git branch -m 2>err && - test_i18ngrep "branch name required" err + test_grep "branch name required" err ' test_expect_success 'git branch -m m broken_symref should work' '
@@ -581,12 +581,12 @@ EOF test_expect_success 'git branch -c dumps usage' ' test_expect_code 128 git branch -c 2>err && - test_i18ngrep "branch name required" err + test_grep "branch name required" err ' test_expect_success 'git branch --copy dumps usage' ' test_expect_code 128 git branch --copy 2>err && - test_i18ngrep "branch name required" err + test_grep "branch name required" err ' test_expect_success 'git branch -c d e should work' '
@@ -1025,7 +1025,7 @@ test_expect_success '--set-upstream-to fails on a missing dst branch' ' test_expect_success '--set-upstream-to fails on a missing src branch' ' test_must_fail git branch --set-upstream-to does-not-exist main 2>err && - test_i18ngrep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err + test_grep "the requested upstream branch '"'"'does-not-exist'"'"' does not exist" err ' test_expect_success '--set-upstream-to fails on a non-ref' '
@@ -1039,7 +1039,7 @@ test_expect_success '--set-upstream-to fails on locked config' ' >.git/config.lock && git branch locked && test_must_fail git branch --set-upstream-to locked 2>err && - test_i18ngrep "could not lock config file .git/config" err + test_grep "could not lock config file .git/config" err ' test_expect_success 'use --set-upstream-to modify HEAD' '
@@ -1070,7 +1070,7 @@ test_expect_success '--unset-upstream should fail if config is locked' ' git branch --set-upstream-to locked && >.git/config.lock && test_must_fail git branch --unset-upstream 2>err && - test_i18ngrep "could not lock config file .git/config" err + test_grep "could not lock config file .git/config" err ' test_expect_success 'test --unset-upstream on HEAD' '
@@ -1506,7 +1506,7 @@ test_expect_success '--list during rebase' ' set_fake_editor && git rebase -i HEAD~2 && git branch --list >actual && - test_i18ngrep "rebasing main" actual + test_grep "rebasing main" actual ' test_expect_success '--list during rebase from detached HEAD' '
@@ -1518,7 +1518,7 @@ test_expect_success '--list during rebase from detached HEAD' ' set_fake_editor && git rebase -i HEAD~2 && git branch --list >actual && - test_i18ngrep "rebasing detached HEAD $oid" actual + test_grep "rebasing detached HEAD $oid" actual ' test_expect_success 'tracking with unexpected .fetch refspec' '
t/t3202-show-branch.sh +1 -1
@@ -253,7 +253,7 @@ test_expect_success 'error descriptions on orphan branch' ' 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_orphan_error -C wt branch $1 $2 && # implicit branch test_orphan_error -C wt branch $1 orphan-branch $2 && # explicit branch
t/t3206-range-diff.sh +11 -11
@@ -195,7 +195,7 @@ test_expect_success 'A^! and A^-<n> (unmodified)' ' test_expect_success 'A^{/..} is not mistaken for a range' ' test_must_fail git range-diff topic^.. topic^{/..} -- 2>error && - test_i18ngrep "not a commit range" error + test_grep "not a commit range" error ' test_expect_success 'trivial reordering' '
@@ -537,7 +537,7 @@ do main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
@@ -549,7 +549,7 @@ test_expect_success 'format-patch --range-diff as commentary' ' git format-patch --range-diff=HEAD~1 HEAD~1 >actual && test_when_finished "rm 0001-*" && test_line_count = 1 actual && - test_i18ngrep "^Range-diff:$" 0001-* && + test_grep "^Range-diff:$" 0001-* && grep "> 1: .* new message" 0001-* '
@@ -557,7 +557,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a non-integer' git format-patch --range-diff=HEAD~1 -v2.9 HEAD~1 >actual && test_when_finished "rm v2.9-0001-*" && test_line_count = 1 actual && - test_i18ngrep "^Range-diff:$" v2.9-0001-* && + test_grep "^Range-diff:$" v2.9-0001-* && grep "> 1: .* new message" v2.9-0001-* '
@@ -565,7 +565,7 @@ test_expect_success 'format-patch --range-diff reroll-count with a integer' ' git format-patch --range-diff=HEAD~1 -v2 HEAD~1 >actual && test_when_finished "rm v2-0001-*" && test_line_count = 1 actual && - test_i18ngrep "^Range-diff ..* v1:$" v2-0001-* && + test_grep "^Range-diff ..* v1:$" v2-0001-* && grep "> 1: .* new message" v2-0001-* '
@@ -573,7 +573,7 @@ test_expect_success 'format-patch --range-diff with v0' ' git format-patch --range-diff=HEAD~1 -v0 HEAD~1 >actual && test_when_finished "rm v0-0001-*" && test_line_count = 1 actual && - test_i18ngrep "^Range-diff:$" v0-0001-* && + test_grep "^Range-diff:$" v0-0001-* && grep "> 1: .* new message" v0-0001-* '
@@ -670,7 +670,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
@@ -687,7 +687,7 @@ test_expect_success 'format-patch --range-diff with --no-notes' ' main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
@@ -704,7 +704,7 @@ test_expect_success 'format-patch --range-diff with --notes' ' main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
@@ -733,7 +733,7 @@ test_expect_success 'format-patch --range-diff with format.notes config' ' main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
@@ -764,7 +764,7 @@ test_expect_success 'format-patch --range-diff with multiple notes' ' main..unmodified >actual && test_when_finished "rm 000?-*" && test_line_count = 5 actual && - test_i18ngrep "^Range-diff:$" 0000-* && + test_grep "^Range-diff:$" 0000-* && grep "= 1: .* s/5/A" 0000-* && grep "= 2: .* s/4/A" 0000-* && grep "= 3: .* s/11/B" 0000-* &&
t/t3210-pack-refs.sh +1 -1
@@ -227,7 +227,7 @@ test_expect_success 'notice d/f conflict with existing directory' ' test_expect_success 'existing directory reports concrete ref' ' test_must_fail git branch foo 2>stderr && - test_i18ngrep refs/heads/foo/bar/baz stderr + test_grep refs/heads/foo/bar/baz stderr ' test_expect_success 'notice d/f conflict with existing ref' '
t/t3301-notes.sh +2 -2
@@ -1469,9 +1469,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' ' test_expect_success 'git notes copy diagnoses too many or too few arguments' ' test_must_fail git notes copy 2>error && - test_i18ngrep "too few arguments" error && + test_grep "too few arguments" error && test_must_fail git notes copy one two three 2>error && - test_i18ngrep "too many arguments" error + test_grep "too many arguments" error ' test_expect_success 'git notes get-ref expands refs/heads/main to refs/notes/refs/heads/main' '
t/t3310-notes-merge-manual-resolve.sh +8 -8
@@ -216,7 +216,7 @@ test_expect_success 'merge z into m (== y) with default ("manual") resolver => C git config core.notesRef refs/notes/m && test_must_fail git notes merge z >output 2>&1 && # Output should point to where to resolve conflicts - test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output && + test_grep "\\.git/NOTES_MERGE_WORKTREE" output && # Inspect merge conflicts ls .git/NOTES_MERGE_WORKTREE >output_conflicts && test_cmp expect_conflicts output_conflicts &&
@@ -263,7 +263,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish test -d .git/NOTES_MERGE_WORKTREE && test_must_fail git notes merge z >output 2>&1 && # Output should indicate what is wrong - test_i18ngrep -q "\\.git/NOTES_MERGE_\\* exists" output + test_grep -q "\\.git/NOTES_MERGE_\\* exists" output ' # Setup non-conflicting merge between x and new notes ref w
@@ -417,7 +417,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol git config core.notesRef refs/notes/m && test_must_fail git notes merge z >output 2>&1 && # Output should point to where to resolve conflicts - test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output && + test_grep "\\.git/NOTES_MERGE_WORKTREE" output && # Inspect merge conflicts ls .git/NOTES_MERGE_WORKTREE >output_conflicts && test_cmp expect_conflicts output_conflicts &&
@@ -449,7 +449,7 @@ git rev-parse refs/notes/z > pre_merge_z test_expect_success 'redo merge of z into m (== y) with default ("manual") resolver => Conflicting 3-way merge' ' test_must_fail git notes merge z >output 2>&1 && # Output should point to where to resolve conflicts - test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output && + test_grep "\\.git/NOTES_MERGE_WORKTREE" output && # Inspect merge conflicts ls .git/NOTES_MERGE_WORKTREE >output_conflicts && test_cmp expect_conflicts output_conflicts &&
@@ -528,7 +528,7 @@ test_expect_success 'redo merge of z into m (== y) with default ("manual") resol git update-ref refs/notes/m refs/notes/y && test_must_fail git notes merge z >output 2>&1 && # Output should point to where to resolve conflicts - test_i18ngrep "\\.git/NOTES_MERGE_WORKTREE" output && + test_grep "\\.git/NOTES_MERGE_WORKTREE" output && # Inspect merge conflicts ls .git/NOTES_MERGE_WORKTREE >output_conflicts && test_cmp expect_conflicts output_conflicts &&
@@ -573,9 +573,9 @@ EOF test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && # Mention refs/notes/m, and its current and expected value in output - test_i18ngrep -q "refs/notes/m" output && - test_i18ngrep -q "$(git rev-parse refs/notes/m)" output && - test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output && + test_grep -q "refs/notes/m" output && + test_grep -q "$(git rev-parse refs/notes/m)" output && + test_grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output && # Verify that other notes refs has not changed (w, x, y and z) verify_notes w && verify_notes x &&
t/t3320-notes-merge-worktrees.sh +2 -2
@@ -57,7 +57,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' ' cd worktree && git config core.notesRef refs/notes/y && test_must_fail git notes merge z 2>err && - test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err + test_grep "a notes merge into refs/notes/y is already in-progress at" err ) && test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF '
@@ -67,7 +67,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' ' cd worktree2 && git config core.notesRef refs/notes/x && test_must_fail git notes merge z >out 2>&1 && - test_i18ngrep "Automatic notes merge failed" out && + test_grep "Automatic notes merge failed" out && grep -v "A notes merge into refs/notes/x is already in-progress in" out ) && echo "refs/notes/x" >expect &&
t/t3321-notes-stripspace.sh +1 -1
@@ -428,7 +428,7 @@ test_expect_success 'add notes with empty messages' ' git notes add -m "${LF}" \ -m "${MULTI_LF}" \ -m "${LF}" >actual 2>&1 && - test_i18ngrep "Removing note for object" actual + test_grep "Removing note for object" actual ' test_expect_success 'add note by specifying "-C", "--no-stripspace" is the default behavior' '
t/t3400-rebase.sh +3 -3
@@ -143,8 +143,8 @@ test_expect_success 'Show verbose error when HEAD could not be detached' ' >B && test_when_finished "rm -f B" && test_must_fail git rebase topic 2>output.err >output.out && - test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" output.err && - test_i18ngrep B output.err + test_grep "The following untracked working tree files would be overwritten by checkout:" output.err && + test_grep B output.err ' test_expect_success 'fail when upstream arg is missing and not on branch' '
@@ -421,7 +421,7 @@ test_expect_success 'refuse to switch to branch checked out elsewhere' ' git checkout main && git worktree add wt && test_must_fail git -C wt rebase main main 2>err && - test_i18ngrep "already checked out" err + test_grep "already checked out" err ' test_expect_success MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' '
t/t3402-rebase-merge.sh +1 -1
@@ -171,7 +171,7 @@ test_expect_success '--reapply-cherry-picks' ' # Regular rebase fails, because the 1-11 commit is deduplicated test_must_fail git -C repo rebase --merge main 2> err && - test_i18ngrep "error: could not apply.*add 12 in another branch" err && + test_grep "error: could not apply.*add 12 in another branch" err && git -C repo rebase --abort && # With --reapply-cherry-picks, it works
t/t3403-rebase-skip.sh +15 -15
@@ -108,10 +108,10 @@ test_expect_success 'correct advice upon picking empty commit' ' test_when_finished "git rebase --abort" && test_must_fail git rebase -i --onto goodbye \ amended-goodbye^ amended-goodbye 2>err && - test_i18ngrep "previous cherry-pick is now empty" err && - test_i18ngrep "git rebase --skip" err && + test_grep "previous cherry-pick is now empty" err && + test_grep "git rebase --skip" err && test_must_fail git commit && - test_i18ngrep "git rebase --skip" err + test_grep "git rebase --skip" err ' test_expect_success 'correct authorship when committing empty pick' '
@@ -131,10 +131,10 @@ test_expect_success 'correct advice upon rewording empty commit' ' test_must_fail env FAKE_LINES="reword 1" git rebase -i \ --onto goodbye amended-goodbye^ amended-goodbye 2>err ) && - test_i18ngrep "previous cherry-pick is now empty" err && - test_i18ngrep "git rebase --skip" err && + test_grep "previous cherry-pick is now empty" err && + test_grep "git rebase --skip" err && test_must_fail git commit && - test_i18ngrep "git rebase --skip" err + test_grep "git rebase --skip" err ' test_expect_success 'correct advice upon editing empty commit' '
@@ -144,10 +144,10 @@ test_expect_success 'correct advice upon editing empty commit' ' test_must_fail env FAKE_LINES="edit 1" git rebase -i \ --onto goodbye amended-goodbye^ amended-goodbye 2>err ) && - test_i18ngrep "previous cherry-pick is now empty" err && - test_i18ngrep "git rebase --skip" err && + test_grep "previous cherry-pick is now empty" err && + test_grep "git rebase --skip" err && test_must_fail git commit && - test_i18ngrep "git rebase --skip" err + test_grep "git rebase --skip" err ' test_expect_success 'correct advice upon cherry-picking an empty commit during a rebase' '
@@ -157,10 +157,10 @@ test_expect_success 'correct advice upon cherry-picking an empty commit during a test_must_fail env FAKE_LINES="1 exec_git_cherry-pick_amended-goodbye" \ git rebase -i goodbye^ goodbye 2>err ) && - test_i18ngrep "previous cherry-pick is now empty" err && - test_i18ngrep "git cherry-pick --skip" err && + test_grep "previous cherry-pick is now empty" err && + test_grep "git cherry-pick --skip" err && test_must_fail git commit 2>err && - test_i18ngrep "git cherry-pick --skip" err + test_grep "git cherry-pick --skip" err ' test_expect_success 'correct advice upon multi cherry-pick picking an empty commit during a rebase' '
@@ -170,10 +170,10 @@ test_expect_success 'correct advice upon multi cherry-pick picking an empty comm test_must_fail env FAKE_LINES="1 exec_git_cherry-pick_goodbye_amended-goodbye" \ git rebase -i goodbye^^ goodbye 2>err ) && - test_i18ngrep "previous cherry-pick is now empty" err && - test_i18ngrep "git cherry-pick --skip" err && + test_grep "previous cherry-pick is now empty" err && + test_grep "git cherry-pick --skip" err && test_must_fail git commit 2>err && - test_i18ngrep "git cherry-pick --skip" err + test_grep "git cherry-pick --skip" err ' test_expect_success 'fixup that empties commit fails' '
t/t3404-rebase-interactive.sh +19 -19
@@ -291,9 +291,9 @@ test_expect_success 'abort with error when new base cannot be checked out' ' git rm --cached file1 && git commit -m "remove file in base" && test_must_fail git rebase -i primary > output 2>&1 && - test_i18ngrep "The following untracked working tree files would be overwritten by checkout:" \ + test_grep "The following untracked working tree files would be overwritten by checkout:" \ output && - test_i18ngrep "file1" output && + test_grep "file1" output && test_path_is_missing .git/rebase-merge && rm file1 && git reset --hard HEAD^
@@ -604,7 +604,7 @@ test_expect_success 'clean error after failed "exec"' ' 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_grep "you have staged changes in your working tree" error ' test_expect_success 'rebase a detached HEAD' '
@@ -955,7 +955,7 @@ test_expect_success 'rebase --exec works without -i ' ' git reset --hard execute && rm -rf exec_output && EDITOR="echo >invoked_editor" git rebase --exec "echo a line >>exec_output" HEAD~2 2>actual && - test_i18ngrep "Successfully rebased and updated" actual && + test_grep "Successfully rebased and updated" actual && test_line_count = 2 exec_output && test_path_is_missing invoked_editor '
@@ -963,7 +963,7 @@ test_expect_success 'rebase --exec works without -i ' ' test_expect_success 'rebase -i --exec without <CMD>' ' git reset --hard execute && test_must_fail git rebase -i --exec 2>actual && - test_i18ngrep "requires a value" actual && + test_grep "requires a value" actual && git checkout primary '
@@ -1272,7 +1272,7 @@ test_expect_success 'todo count' ' test_set_editor "$(pwd)/dump-raw.sh" && git rebase -i HEAD~4 >actual ) && - test_i18ngrep "^# Rebase ..* onto ..* ([0-9]" actual + test_grep "^# Rebase ..* onto ..* ([0-9]" actual ' test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '
@@ -1379,7 +1379,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' ' FAKE_LINES="1 2 3 4" git rebase -i --root 2>actual ) && test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ + test_grep \ "Successfully rebased and updated refs/heads/missing-commit" \ actual '
@@ -1442,7 +1442,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ig git rebase --continue 2>actual ) && test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ + test_grep \ "Successfully rebased and updated refs/heads/missing-commit" \ actual '
@@ -1477,7 +1477,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = wa git rebase --continue 2>actual ) && test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ + test_grep \ "Successfully rebased and updated refs/heads/missing-commit" \ actual '
@@ -1525,7 +1525,7 @@ test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = er git rebase --continue 2>actual ) && test D = $(git cat-file commit HEAD | sed -ne \$p) && - test_i18ngrep \ + test_grep \ "Successfully rebased and updated refs/heads/missing-commit" \ actual '
@@ -1585,9 +1585,9 @@ test_expect_success 'static check of bad command' ' set_fake_editor && test_must_fail env FAKE_LINES="1 2 3 bad 4 5" \ git rebase -i --root 2>actual && - test_i18ngrep "pickled $(git rev-list --oneline -1 primary~1)" \ + test_grep "pickled $(git rev-list --oneline -1 primary~1)" \ actual && - test_i18ngrep "You can fix this with .git rebase --edit-todo.." \ + test_grep "You can fix this with .git rebase --edit-todo.." \ actual && FAKE_LINES="1 2 3 drop 4 5" git rebase --edit-todo ) &&
@@ -1645,8 +1645,8 @@ test_expect_success 'static check of bad SHA-1' ' set_fake_editor && test_must_fail env FAKE_LINES="1 2 edit fakesha 3 4 5 #" \ git rebase -i --root 2>actual && - test_i18ngrep "edit XXXXXXX False commit" actual && - test_i18ngrep "You can fix this with .git rebase --edit-todo.." \ + test_grep "edit XXXXXXX False commit" actual && + test_grep "You can fix this with .git rebase --edit-todo.." \ actual && FAKE_LINES="1 2 4 5 6" git rebase --edit-todo ) &&
@@ -1673,7 +1673,7 @@ test_expect_success 'rebase -i --gpg-sign=<key-id>' ' FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \ HEAD^ >out 2>err ) && - test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err + test_grep "$SQ-S\"S I Gner\"$SQ" err ' test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' '
@@ -1684,7 +1684,7 @@ test_expect_success 'rebase -i --gpg-sign=<key-id> overrides commit.gpgSign' ' FAKE_LINES="edit 1" git rebase -i --gpg-sign="\"S I Gner\"" \ HEAD^ >out 2>err ) && - test_i18ngrep "$SQ-S\"S I Gner\"$SQ" err + test_grep "$SQ-S\"S I Gner\"$SQ" err ' test_expect_success 'valid author header after --root swap' '
@@ -1738,7 +1738,7 @@ test_expect_success 'correct error message for partial commit after empty pick' ) && echo x >file1 && test_must_fail git commit file1 2>err && - test_i18ngrep "cannot do a partial commit during a rebase." err + test_grep "cannot do a partial commit during a rebase." err ' test_expect_success 'correct error message for commit --amend after empty pick' '
@@ -1751,13 +1751,13 @@ test_expect_success 'correct error message for commit --amend after empty pick' ) && echo x>file1 && test_must_fail git commit -a --amend 2>err && - test_i18ngrep "middle of a rebase -- cannot amend." err + test_grep "middle of a rebase -- cannot amend." err ' test_expect_success 'todo has correct onto hash' ' GIT_SEQUENCE_EDITOR=cat git rebase -i no-conflict-branch~4 no-conflict-branch >actual && onto=$(git rev-parse --short HEAD~4) && - test_i18ngrep "^# Rebase ..* onto $onto" actual + test_grep "^# Rebase ..* onto $onto" actual ' test_expect_success 'ORIG_HEAD is updated correctly' '
t/t3406-rebase-message.sh +9 -9
@@ -33,24 +33,24 @@ test_expect_success 'rebase -m' ' test_expect_success 'rebase against main twice' ' git rebase --apply main >out && - test_i18ngrep "Current branch topic is up to date" out + test_grep "Current branch topic is up to date" out ' test_expect_success 'rebase against main twice with --force' ' git rebase --force-rebase --apply main >out && - test_i18ngrep "Current branch topic is up to date, rebase forced" out + test_grep "Current branch topic is up to date, rebase forced" out ' test_expect_success 'rebase against main twice from another branch' ' git checkout topic^ && git rebase --apply main topic >out && - test_i18ngrep "Current branch topic is up to date" out + test_grep "Current branch topic is up to date" out ' test_expect_success 'rebase fast-forward to main' ' git checkout topic^ && git rebase --apply topic >out && - test_i18ngrep "Fast-forwarded HEAD to topic" out + test_grep "Fast-forwarded HEAD to topic" out ' test_expect_success 'rebase --stat' '
@@ -75,14 +75,14 @@ test_expect_success 'rebase -n overrides config rebase.stat config' ' test_expect_success 'rebase --onto outputs the invalid ref' ' test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err && - test_i18ngrep "invalid-ref" err + test_grep "invalid-ref" err ' test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' ' test_must_fail git rebase -Cnot-a-number HEAD 2>err && - test_i18ngrep "numerical value" err && + test_grep "numerical value" err && test_must_fail git rebase --whitespace=bad HEAD 2>err && - test_i18ngrep "Invalid whitespace option" err + test_grep "Invalid whitespace option" err ' write_reflog_expect () {
@@ -251,8 +251,8 @@ test_expect_success 'rebase -i onto unrelated history' ' git -C unrelated remote add -f origin "$PWD" && git -C unrelated branch --set-upstream-to=origin/main && git -C unrelated -c core.editor=true rebase -i -v --stat >actual && - test_i18ngrep "Changes to " actual && - test_i18ngrep "5 files changed" actual + test_grep "Changes to " actual && + test_grep "5 files changed" actual ' test_done
t/t3418-rebase-continue.sh +3 -3
@@ -182,8 +182,8 @@ test_expect_success '--skip after failed fixup cleans commit message' ' : Final squash failed, but there was still a squash && head -n1 .git/copy.txt >first-line && - test_i18ngrep "# This is a combination of 3 commits" first-line && - test_i18ngrep "# This is the commit message #3:" .git/copy.txt + test_grep "# This is a combination of 3 commits" first-line && + test_grep "# This is the commit message #3:" .git/copy.txt ' test_expect_success 'setup rerere database' '
@@ -276,7 +276,7 @@ test_expect_success '--reschedule-failed-exec' ' test_must_fail git -c rebase.rescheduleFailedExec=true \ rebase -x false HEAD^ 2>err && grep "^exec false" .git/rebase-merge/git-rebase-todo && - test_i18ngrep "has been rescheduled" err + test_grep "has been rescheduled" err ' test_expect_success 'rebase.rescheduleFailedExec only affects `rebase -i`' '
t/t3431-rebase-fork-point.sh +1 -1
@@ -84,7 +84,7 @@ test_expect_success 'git rebase --fork-point with ambigous refname' ' test_expect_success '--fork-point and --root both given' ' test_must_fail git rebase --fork-point --root 2>err && - test_i18ngrep "cannot be used together" err + test_grep "cannot be used together" err ' test_expect_success 'rebase.forkPoint set to false' '
t/t3501-revert-cherry-pick.sh +3 -3
@@ -43,7 +43,7 @@ test_expect_success 'cherry-pick --nonsense' ' git diff --exit-code HEAD && test_must_fail git cherry-pick --nonsense 2>msg && git diff --exit-code HEAD "$pos" && - test_i18ngrep "[Uu]sage:" msg + test_grep "[Uu]sage:" msg ' test_expect_success 'revert --nonsense' '
@@ -52,7 +52,7 @@ test_expect_success 'revert --nonsense' ' git diff --exit-code HEAD && test_must_fail git revert --nonsense 2>msg && git diff --exit-code HEAD "$pos" && - test_i18ngrep "[Uu]sage:" msg + test_grep "[Uu]sage:" msg ' # the following two test cherry-pick and revert with renames
@@ -99,7 +99,7 @@ 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 && - test_i18ngrep "your local changes would be overwritten by " errors + test_grep "your local changes would be overwritten by " errors '
t/t3507-cherry-pick-conflict.sh +4 -4
@@ -177,7 +177,7 @@ test_expect_success 'partial commit of cherry-pick fails' ' git add foo && test_must_fail git commit foo 2>err && - test_i18ngrep "cannot do a partial commit during a cherry-pick." err + test_grep "cannot do a partial commit during a cherry-pick." err ' test_expect_success 'commit --amend of cherry-pick fails' '
@@ -188,7 +188,7 @@ test_expect_success 'commit --amend of cherry-pick fails' ' git add foo && test_must_fail git commit --amend 2>err && - test_i18ngrep "in the middle of a cherry-pick -- cannot amend." err + test_grep "in the middle of a cherry-pick -- cannot amend." err ' test_expect_success 'successful final commit clears cherry-pick state' '
@@ -498,7 +498,7 @@ test_expect_success \ test_expect_success 'failed cherry-pick does not forget -s' ' pristine_detach initial && test_must_fail git cherry-pick -s picked && - test_i18ngrep -e "Signed-off-by" .git/MERGE_MSG + test_grep -e "Signed-off-by" .git/MERGE_MSG ' test_expect_success 'commit after failed cherry-pick does not add duplicated -s' '
@@ -563,7 +563,7 @@ test_expect_success 'cherry-pick preserves sparse-checkout' ' echo /unrelated >.git/info/sparse-checkout && git read-tree --reset -u HEAD && test_must_fail git cherry-pick -Xours picked>actual && - test_i18ngrep ! "Changes not staged for commit:" actual + test_grep ! "Changes not staged for commit:" actual ' test_expect_success 'cherry-pick --continue remembers --keep-redundant-commits' '
t/t3510-cherry-pick-sequence.sh +3 -3
@@ -154,7 +154,7 @@ test_expect_success 'skip "empty" commit' ' pristine_detach picked && test_commit dummy foo d && test_must_fail git cherry-pick anotherpick 2>err && - test_i18ngrep "git cherry-pick --skip" err && + test_grep "git cherry-pick --skip" err && git cherry-pick --skip && test_cmp_rev dummy HEAD '
@@ -314,7 +314,7 @@ test_expect_success '--abort does not unsafely change HEAD' ' git reset --hard base && test_must_fail git cherry-pick picked anotherpick && git cherry-pick --abort 2>actual && - test_i18ngrep "You seem to have moved HEAD" actual && + test_grep "You seem to have moved HEAD" actual && test_cmp_rev base HEAD '
@@ -520,7 +520,7 @@ test_expect_success '--continue asks for help after resolving patch to nil' ' test_cmp_rev unrelatedpick CHERRY_PICK_HEAD && git checkout HEAD -- unrelated && test_must_fail git cherry-pick --continue 2>msg && - test_i18ngrep "The previous cherry-pick is now empty" msg + test_grep "The previous cherry-pick is now empty" msg ' test_expect_success 'follow advice and skip nil patch' '
t/t3600-rm.sh +4 -4
@@ -276,7 +276,7 @@ test_expect_success 'Resolving by removal is not a warning-worthy event' ' blob=$(echo blob | git hash-object -w --stdin) && printf "100644 $blob %d\tblob\n" 1 2 3 | git update-index --index-info && git rm blob >msg 2>&1 && - test_i18ngrep ! "needs merge" msg && + test_grep ! "needs merge" msg && test_must_fail git ls-files -s --error-unmatch blob '
@@ -631,7 +631,7 @@ test_expect_success 'rm of a populated submodule with a .git directory migrates test_path_is_missing submod/.git && git status -s -uno --ignore-submodules=none >actual && test_file_not_empty actual && - test_i18ngrep Migrating output.err + test_grep Migrating output.err ' cat >expect.deepmodified <<EOF
@@ -722,7 +722,7 @@ test_expect_success "rm absorbs submodule's nested .git directory" ' test_path_is_missing submod/subsubmod/.git && git status -s -uno --ignore-submodules=none >actual && test_file_not_empty actual && - test_i18ngrep Migrating output.err + test_grep Migrating output.err ' test_expect_success 'checking out a commit after submodule removal needs manual updates' '
@@ -731,7 +731,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual git submodule update && git checkout -q HEAD^ && git checkout -q main 2>actual && - test_i18ngrep "^warning: unable to rmdir '\''submod'\'':" actual && + test_grep "^warning: unable to rmdir '\''submod'\'':" actual && git status -s submod >actual && echo "?? submod/" >expected && test_cmp expected actual &&
t/t3601-rm-pathspec-file.sh +3 -3
@@ -67,14 +67,14 @@ test_expect_success 'error conditions' ' echo fileA.t >list && test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && test_must_fail git rm --pathspec-file-nul 2>err && - test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && >empty_list && test_must_fail git rm --pathspec-from-file=empty_list 2>err && - test_i18ngrep -e "No pathspec was given. Which files should I remove?" err + test_grep -e "No pathspec was given. Which files should I remove?" err ' test_done
t/t3700-add.sh +3 -3
@@ -438,7 +438,7 @@ test_expect_success 'git add --chmod fails with non regular files (but updates t test_ln_s_add foo foo3 && touch foo4 && test_must_fail git add --chmod=+x foo3 foo4 2>stderr && - test_i18ngrep "cannot chmod +x .foo3." stderr && + test_grep "cannot chmod +x .foo3." stderr && test_mode_in_index 120000 foo3 && test_mode_in_index 100755 foo4 '
@@ -455,12 +455,12 @@ test_expect_success 'git add --chmod --dry-run reports error for non regular fil git reset --hard && test_ln_s_add foo foo4 && test_must_fail git add --chmod=+x --dry-run foo4 2>stderr && - test_i18ngrep "cannot chmod +x .foo4." stderr + test_grep "cannot chmod +x .foo4." stderr ' test_expect_success 'git add --chmod --dry-run reports error for unmatched pathspec' ' test_must_fail git add --chmod=+x --dry-run nonexistent 2>stderr && - test_i18ngrep "pathspec .nonexistent. did not match any files" stderr + test_grep "pathspec .nonexistent. did not match any files" stderr ' test_expect_success 'no file status change if no pathspec is given' '
t/t3701-add-interactive.sh +4 -4
@@ -335,12 +335,12 @@ test_expect_success 'different prompts for mode change/deleted' ' test_expect_success 'correct message when there is nothing to do' ' git reset --hard && git add -p 2>err && - test_i18ngrep "No changes" err && + test_grep "No changes" err && printf "\\0123" >binary && git add binary && printf "\\0abc" >binary && git add -p 2>err && - test_i18ngrep "Only binary files changed" err + test_grep "Only binary files changed" err ' test_expect_success 'setup again' '
@@ -497,7 +497,7 @@ test_expect_success 'adding an empty file' ' echo y | git checkout -p added-file -- >actual && test_path_is_file empty && - test_i18ngrep "Apply addition to index and worktree" actual + test_grep "Apply addition to index and worktree" actual ) '
@@ -838,7 +838,7 @@ test_expect_success 'diff.algorithm is passed to `git diff-files`' ' git add file && echo changed >file && test_must_fail git -c diff.algorithm=bogus add -p 2>err && - test_i18ngrep "error: option diff-algorithm accepts " err + test_grep "error: option diff-algorithm accepts " err ' test_expect_success 'patch-mode via -i prompts for files' '
t/t3704-add-pathspec-file.sh +6 -6
@@ -138,23 +138,23 @@ test_expect_success 'error conditions' ' >empty_list && test_must_fail git add --pathspec-from-file=list --interactive 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && test_must_fail git add --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--interactive/--patch. cannot be used together" err && test_must_fail git add --pathspec-from-file=list --edit 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--edit. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--edit. cannot be used together" err && test_must_fail git add --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && test_must_fail git add --pathspec-file-nul 2>err && - test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err && # This case succeeds, but still prints to stderr git add --pathspec-from-file=empty_list 2>err && - test_i18ngrep -e "Nothing specified, nothing added." err + test_grep -e "Nothing specified, nothing added." err ' test_done
t/t3900-i18n-commit.sh +4 -4
@@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' ' printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \ >"$HOME/invalid" && git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && - test_i18ngrep "did not conform" "$HOME"/stderr + test_grep "did not conform" "$HOME"/stderr ' test_expect_success 'UTF-8 overlong sequences rejected' '
@@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' ' printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \ >"$HOME/invalid" && git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && - test_i18ngrep "did not conform" "$HOME"/stderr + test_grep "did not conform" "$HOME"/stderr ' test_expect_success 'UTF-8 non-characters refused' '
@@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' ' printf "Commit message\n\nNon-character:\364\217\277\276\n" \ >"$HOME/invalid" && git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && - test_i18ngrep "did not conform" "$HOME"/stderr + test_grep "did not conform" "$HOME"/stderr ' test_expect_success 'UTF-8 non-characters refused' '
@@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' ' printf "Commit message\n\nNon-character:\357\267\220\n" \ >"$HOME/invalid" && git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && - test_i18ngrep "did not conform" "$HOME"/stderr + test_grep "did not conform" "$HOME"/stderr ' for H in ISO8859-1 eucJP ISO-2022-JP
t/t3901-i18n-patch.sh +1 -1
@@ -298,7 +298,7 @@ test_expect_success 'am --no-utf8 (U/L)' ' # commit-tree will warn that the commit message does not contain valid UTF-8 # as mailinfo did not convert it - test_i18ngrep "did not conform" err && + test_grep "did not conform" err && check_encoding 2 '
t/t3903-stash.sh +5 -5
@@ -395,7 +395,7 @@ test_expect_success 'stash --staged' ' test_expect_success 'dont assume push with non-option args' ' test_must_fail git stash -q drop 2>err && - test_i18ngrep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err + test_grep -e "subcommand wasn'\''t specified; '\''push'\'' can'\''t be assumed due to unexpected token '\''drop'\''" err ' test_expect_success 'stash --invalid-option' '
@@ -596,7 +596,7 @@ test_expect_success 'giving too many ref arguments does not modify files' ' for type in apply pop "branch stash-branch" do test_must_fail git stash $type stash@{0} stash@{1} 2>err && - test_i18ngrep "Too many revisions" err && + test_grep "Too many revisions" err && test 123456789 = $(test-tool chmtime -g file2) || return 1 done '
@@ -604,14 +604,14 @@ test_expect_success 'giving too many ref arguments does not modify files' ' test_expect_success 'drop: too many arguments errors out (does nothing)' ' git stash list >expect && test_must_fail git stash drop stash@{0} stash@{1} 2>err && - test_i18ngrep "Too many revisions" err && + test_grep "Too many revisions" err && git stash list >actual && test_cmp expect actual ' test_expect_success 'show: too many arguments errors out (does nothing)' ' test_must_fail git stash show stash@{0} stash@{1} 2>err 1>out && - test_i18ngrep "Too many revisions" err && + test_grep "Too many revisions" err && test_must_be_empty out '
@@ -654,7 +654,7 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' ' test_expect_success 'stash branch complains with no arguments' ' test_must_fail git stash branch 2>err && - test_i18ngrep "No branch name specified" err + test_grep "No branch name specified" err ' test_expect_success 'stash show format defaults to --stat' '
t/t3905-stash-include-untracked.sh +1 -1
@@ -404,7 +404,7 @@ test_expect_success 'stash show --include-untracked errors on duplicate files' ' ) && w_commit=$(git commit-tree -p HEAD -p "$i_commit" -p "$u_commit" -m "WIP on any-branch" "$tree") && test_must_fail git stash show --include-untracked "$w_commit" 2>err && - test_i18ngrep "worktree and untracked commit have duplicate entries: tracked" err + test_grep "worktree and untracked commit have duplicate entries: tracked" err ' test_expect_success 'stash show --{include,only}-untracked on stashes without untracked entries' '
t/t3909-stash-pathspec-file.sh +3 -3
@@ -88,13 +88,13 @@ test_expect_success 'error conditions' ' echo fileA.t >list && test_must_fail git stash push --pathspec-from-file=list --patch 2>err && - test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && + test_grep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err && test_must_fail git stash push --pathspec-from-file=list -- fileA.t 2>err && - test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && + test_grep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err && test_must_fail git stash push --pathspec-file-nul 2>err && - test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err + test_grep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err ' test_done
t/t4001-diff-rename.sh +17 -17
@@ -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 + test_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 + test_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 + test_grep ! "renamed: .*path1 -> subdir/path1" out && + test_grep "new file: .*subdir/path1" out && + test_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 + test_grep "renamed: .*path1 -> subdir/path1" out ' test_expect_success 'two files with same basename and same content' '
@@ -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 + test_grep "renamed: .*dir/A/file -> other-dir/A/file" out ' test_expect_success 'setup for many rename source candidates' '
@@ -202,9 +202,9 @@ 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 && + test_grep " a/b/c => c/b/a " output && git diff -M --stat HEAD^ HEAD >output && - test_i18ngrep " a/b/c => c/b/a " output + test_grep " a/b/c => c/b/a " output ' test_expect_success 'rename pretty print with common prefix' '
@@ -212,9 +212,9 @@ test_expect_success 'rename pretty print with common prefix' ' 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 && + test_grep " c/{b/a => d/e} " output && git diff -M --stat HEAD^ HEAD >output && - test_i18ngrep " c/{b/a => d/e} " output + test_grep " c/{b/a => d/e} " output ' test_expect_success 'rename pretty print with common suffix' '
@@ -222,9 +222,9 @@ test_expect_success 'rename pretty print with common suffix' ' 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 && + test_grep " {c/d => d}/e " output && git diff -M --stat HEAD^ HEAD >output && - test_i18ngrep " {c/d => d}/e " output + test_grep " {c/d => d}/e " output ' test_expect_success 'rename pretty print with common prefix and suffix' '
@@ -232,9 +232,9 @@ test_expect_success 'rename pretty print with common prefix and suffix' ' 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 && + test_grep " d/{ => f}/e " output && git diff -M --stat HEAD^ HEAD >output && - test_i18ngrep " d/{ => f}/e " output + test_grep " d/{ => f}/e " output ' test_expect_success 'rename pretty print common prefix and suffix overlap' '
@@ -242,9 +242,9 @@ test_expect_success 'rename pretty print common prefix and suffix overlap' ' 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 && + test_grep " d/f/{ => f}/e " output && git diff -M --stat HEAD^ HEAD >output && - test_i18ngrep " d/f/{ => f}/e " output + test_grep " d/f/{ => f}/e " output ' test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
t/t4013-diff-various.sh +1 -1
@@ -613,7 +613,7 @@ test_expect_success 'diff -I<regex> --stat' ' test_expect_success 'diff -I<regex>: detect malformed regex' ' test_expect_code 129 git diff --ignore-matching-lines="^[124-9" 2>error && - test_i18ngrep "invalid regex given to -I: " error + test_grep "invalid regex given to -I: " error ' # check_prefix <patch> <src> <dst>
t/t4014-format-patch.sh +6 -6
@@ -2369,25 +2369,25 @@ test_expect_success 'interdiff: cover-letter' ' --q EOF git format-patch --cover-letter --interdiff=boop~2 -1 boop && - test_i18ngrep "^Interdiff:$" 0000-cover-letter.patch && - test_i18ngrep ! "^Interdiff:$" 0001-fleep.patch && + test_grep "^Interdiff:$" 0000-cover-letter.patch && + test_grep ! "^Interdiff:$" 0001-fleep.patch && sed "1,/^@@ /d; /^-- $/q" 0000-cover-letter.patch >actual && test_cmp expect actual ' test_expect_success 'interdiff: reroll-count' ' git format-patch --cover-letter --interdiff=boop~2 -v2 -1 boop && - test_i18ngrep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch + test_grep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch ' test_expect_success 'interdiff: reroll-count with a non-integer' ' git format-patch --cover-letter --interdiff=boop~2 -v2.2 -1 boop && - test_i18ngrep "^Interdiff:$" v2.2-0000-cover-letter.patch + test_grep "^Interdiff:$" v2.2-0000-cover-letter.patch ' test_expect_success 'interdiff: reroll-count with a integer' ' git format-patch --cover-letter --interdiff=boop~2 -v2 -1 boop && - test_i18ngrep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch + test_grep "^Interdiff ..* v1:$" v2-0000-cover-letter.patch ' test_expect_success 'interdiff: solo-patch' '
@@ -2396,7 +2396,7 @@ test_expect_success 'interdiff: solo-patch' ' EOF git format-patch --interdiff=boop~2 -1 boop && - test_i18ngrep "^Interdiff:$" 0001-fleep.patch && + test_grep "^Interdiff:$" 0001-fleep.patch && sed "1,/^ @@ /d; /^$/q" 0001-fleep.patch >actual && test_cmp expect actual '
t/t4015-diff-whitespace.sh +10 -10
@@ -909,7 +909,7 @@ test_expect_success 'combined diff with autocrlf conversion' ' git commit -m "the other side" x && git config core.autocrlf true && test_must_fail git merge one-side >actual && - test_i18ngrep "Automatic merge failed" actual && + test_grep "Automatic merge failed" actual && git diff >actual.raw &&
Lines of this file are not shown. View the raw message.
t/t5411/test-0027-push-options--porcelain.sh +1 -1
Lines of this file are not shown. View the raw message.
t/t6423-merge-rename-directories.sh +70 -70
140 lines not on this page · raw message
t/t6424-merge-unrelated-index-changes.sh +3 -3
Lines of this file are not shown. View the raw message.
t/t7400-submodule-basic.sh +32 -32
64 lines not on this page · raw message
t/t7500-commit-template-squash-signoff.sh +1 -1
Lines of this file are not shown. View the raw message.
t/t7525-status-rename.sh +27 -27
54 lines not on this page · raw message
t/t7601-merge-pull-config.sh +25 -25
50 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.42.0-530-g692be87cbb
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/2] tests: teach callers of test_i18ngrep to use test_grep
Hi Junio
Quoted 11 lines · Junio C Hamano
They are equivalents and the former still exists, so as long as the only change this commit makes are to rewrite
test_i18ngreptotest_grep, there won't be any new bug, even if there still are callers oftest_i18ngrepremaining in the tree, or when merged to other topics that add new uses oftest_i18ngrep.This patch was produced more or less with
git grep -l -e '
test_i18ngrep' 't/t[0-9][0-9][0-9][0-9]-*.sh' | xargs perl -p -i -e 's/test_i18ngrep /test_grep /'
Quoted 6 lines
and a good way to sanity check the result yourself is to run the above in a checkout of
c4603c1c(test framework: further deprecatetest_i18ngrep, 2023-10-31) and compare the resulting working tree contents with the result of applying this patch to the same commit. You'll see thattest_i18ngrepin a fewt/lib-*.shfiles corrected, in addition to the manual reproduction.
Thanks for working on this. I have checked what you have in seen by checking out the first parent of ce56983dd3 (Merge branch 'jc/test-i18ngrep' into seen, 2023-11-01) and then converting "test_i18ngrep" to "test_grep" and diffing the result as you suggest above. The diff looks good and shows that you've corrected the additional t/lib-*.sh files. Grepping ce56983dd3 for "test_i18ngrep" shows there is one instance of test_i18ngrep that has not been coverted in contrib/mw-to-git/t/t9363-mw-to-git-export-import.sh.
Best Wishes
Phillip
Re: [PATCH 2/2] tests: teach callers of test_i18ngrep to use test_grep
Quoted 3 lines · Phillip Wood
additional
t/lib-*.shfiles. Greppingce56983dd3for "test_i18ngrep" shows there is one instance oftest_i18ngrepthat has not been coverted incontrib/mw-to-git/t/t9363-mw-to-git-export-import.sh.
Thanks. I'll tweak the patch to update that instance. As we are not removing test_i18ngrep with this series, any test_i18ngrep left unconverted should not break anything, but that is primarily to deal with any new callsites that is added on other topics in-flight, and I should make sure the ones that are known in my tree are converted.
v4 cover bugreport: reject positional arguments
In reply to [email protected]From: Emily Shaffer <[email protected]>
The test I cribbed from for the newly added one in patch 2 was still using test_i18ngrep, and Eric mentioned us not wanting i18ngrep at all anymore, so I went ahead and cleaned that up as well.
- Emily
Emily Shaffer (2):
t0091-bugreport: stop using i18ngrep
bugreport: reject positional arguments
builtin/bugreport.c | 5 +++++ t/t0091-bugreport.sh | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Signature · 1 line
2.42.0.820.g83a721a137-goog
Re: [PATCH v4 0/2] bugreport: reject positional arguments
Quoted 3 lines · On Thu, Oct 26, 2023 at 2:22 PM <[email protected]> wrote:
The test I cribbed from for the newly added one in patch 2 was still using
test_i18ngrep, and Eric mentioned us not wanting i18ngrep at all anymore, so I went ahead and cleaned that up as well.
Thanks for making the various tweaks in response to my review comments.
PATCH v4 1/2 t0091-bugreport: stop using i18ngrep
In reply to [email protected]From: Emily Shaffer <[email protected]>
Since e6545201ad (Merge branch 'ab/detox-config-gettext', 2021-04-13), test_i18ngrep is no longer required. Quit using it in the bugreport tests, since it's setting a bad example for tests added later.
--- t/t0091-bugreport.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
t/t0091-bugreport.sh +1 -1
@@ -65,7 +65,7 @@ test_expect_success '--output-directory puts the report in the provided dir' ' test_expect_success 'incorrect arguments abort with usage' ' test_must_fail git bugreport --false 2>output && - test_i18ngrep usage output && + grep usage output && test_path_is_missing git-bugreport-* '
Signature · 1 line
2.42.0.820.g83a721a137-goog
Re: [PATCH v4 1/2] t0091-bugreport: stop using i18ngrep
Quoted 8 lines · [email protected] writes:
From: Emily Shaffer <[email protected]>
Since
e6545201ad(Merge branch 'ab/detox-config-gettext', 2021-04-13),test_i18ngrepis no longer required. Quit using it in the bugreport tests, since it's setting a bad example for tests added later.Signed-off-by Emily Shaffer <[email protected]>---
Makes sense. Thanks.
Quoted 15 lines
t/t0091-bugreport.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)t/t0091-bugreport.sh +1
-1@@ -65,7 +65,7 @@ test_expect_success '--output-directory puts the report in the provided dir' ' test_expect_success 'incorrect arguments abort with usage' ' test_must_fail git bugreport --false 2>output && - test_i18ngrep usage output && + grep usage output && test_path_is_missing git-bugreport-* '
PATCH v4 2/2 bugreport: reject positional arguments
In reply to [email protected]From: Emily Shaffer <[email protected]>
git-bugreport already rejected unrecognized flag arguments, like --diaggnose, but this doesn't help if the user's mistake was to forget the -- in front of the argument. This can result in a user's intended argument not being parsed with no indication to the user that something went wrong. Since git-bugreport presently doesn't take any positionals at all, let's reject all positionals and give the user a usage hint.
--- builtin/bugreport.c | 5 +++++ t/t0091-bugreport.sh | 7 +++++++ 2 files changed, 12 insertions(+)
builtin/bugreport.c +5 -0
@@ -126,6 +126,11 @@ int cmd_bugreport(int argc, const char **argv, const char *prefix) argc =parse_options (argc, argv, prefix, bugreport_options, bugreport_usage,0 ); +if (argc) { +error (_ ("unknown argument `%s'" ), argv[0 ]); +usage (bugreport_usage[0 ]); + } +/* Prepare the path to put the result */ prefixed_filename =prefix_filename (prefix, option_output ? option_output :"" );
t/t0091-bugreport.sh +7 -0
@@ -69,6 +69,13 @@ test_expect_success 'incorrect arguments abort with usage' ' test_path_is_missing git-bugreport-* ' +test_expect_success 'incorrect positional arguments abort with usage and hint' ' + test_must_fail git bugreport false 2>output && + grep usage output && + 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
Signature · 1 line
2.42.0.820.g83a721a137-goog