From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Johannes.Schindelin@gmx.de, ps@pks.im,
james@jamesliu.io, Derrick Stolee <stolee@gmail.com>,
Derrick Stolee <derrickstolee@github.com>
Subject: [PATCH 4/7] t6000: add GIT_ADVICE=1 to advice tests
Date: Wed, 21 Aug 2024 11:02:29 +0000 [thread overview]
Message-ID: <1ce8a8050e13fa5f24dace3ae03ff0e6a5a71aa9.1724238153.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1776.git.1724238152.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>
Several tests validate the exact output of stderr, including when the stderr
file should be empty. In advance of modifying the advice system to only
output when stderr is a terminal, force the advice system to output in these
cases.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
t/t6001-rev-list-graft.sh | 4 ++--
t/t6050-replace.sh | 6 +++---
t/t6436-merge-overwrite.sh | 6 +++---
t/t6437-submodule-merge.sh | 16 ++++++++--------
t/t6439-merge-co-error-msgs.sh | 12 ++++++------
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/t/t6001-rev-list-graft.sh b/t/t6001-rev-list-graft.sh
index 3553bbbfe73..e3f19621727 100755
--- a/t/t6001-rev-list-graft.sh
+++ b/t/t6001-rev-list-graft.sh
@@ -118,10 +118,10 @@ do
done
test_expect_success 'show advice that grafts are deprecated' '
- git show HEAD 2>err &&
+ GIT_ADVICE=1 git show HEAD 2>err &&
test_grep "git replace" err &&
test_config advice.graftFileDeprecated false &&
- git show HEAD 2>err &&
+ GIT_ADVICE=1 git show HEAD 2>err &&
test_grep ! "git replace" err
'
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index c6e9b33e44e..fc48cb4b0ad 100755
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
@@ -489,9 +489,9 @@ test_expect_success '--convert-graft-file' '
printf "%s\n%s %s\n\n# comment\n%s\n" \
$(git rev-parse HEAD^^ HEAD^ HEAD^^ HEAD^2) \
>.git/info/grafts &&
- git status 2>stderr &&
+ GIT_ADVICE=1 git status 2>stderr &&
test_grep "hint:.*grafts is deprecated" stderr &&
- git replace --convert-graft-file 2>stderr &&
+ GIT_ADVICE=1 git replace --convert-graft-file 2>stderr &&
test_grep ! "hint:.*grafts is deprecated" stderr &&
test_path_is_missing .git/info/grafts &&
@@ -502,7 +502,7 @@ test_expect_success '--convert-graft-file' '
: create invalid graft file and verify that it is not deleted &&
test_when_finished "rm -f .git/info/grafts" &&
echo $EMPTY_BLOB $EMPTY_TREE >.git/info/grafts &&
- test_must_fail git replace --convert-graft-file 2>err &&
+ test_env GIT_ADVICE=1 test_must_fail git replace --convert-graft-file 2>err &&
test_grep "$EMPTY_BLOB $EMPTY_TREE" err &&
test_grep "$EMPTY_BLOB $EMPTY_TREE" .git/info/grafts
'
diff --git a/t/t6436-merge-overwrite.sh b/t/t6436-merge-overwrite.sh
index ccc620477d4..7c9f5b623f1 100755
--- a/t/t6436-merge-overwrite.sh
+++ b/t/t6436-merge-overwrite.sh
@@ -104,7 +104,7 @@ test_expect_success 'will not overwrite unstaged changes in renamed file' '
cp important other.c &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
- test_must_fail git merge c1a >out 2>err &&
+ test_env GIT_ADVICE=1 test_must_fail git merge c1a >out 2>err &&
test_grep "would be overwritten by merge" err &&
test_cmp important other.c &&
test_path_is_missing .git/MERGE_HEAD
@@ -140,7 +140,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '
rm -rf sub &&
cp important sub &&
cp important sub2 &&
- test_must_fail git merge sub 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git merge sub 2>out &&
test_cmp out expect &&
test_path_is_missing .git/MERGE_HEAD &&
test_cmp important sub &&
@@ -175,7 +175,7 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
git rm -fr . &&
git checkout --orphan new &&
cp important c0.c &&
- test_must_fail git merge c0 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git merge c0 2>out &&
test_cmp out expect
'
diff --git a/t/t6437-submodule-merge.sh b/t/t6437-submodule-merge.sh
index 7a3f1cb27c1..9265cebca75 100755
--- a/t/t6437-submodule-merge.sh
+++ b/t/t6437-submodule-merge.sh
@@ -113,11 +113,11 @@ test_expect_success 'merging should conflict for non fast-forward' '
git checkout -b test-nonforward-a b &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
- test_must_fail git merge c 2>actual &&
+ test_env GIT_ADVICE=1 test_must_fail git merge c 2>actual &&
sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
grep "$sub_expect" actual
else
- test_must_fail git merge c 2> actual
+ test_env GIT_ADVICE=1 test_must_fail git merge c 2> actual
fi)
'
@@ -154,11 +154,11 @@ test_expect_success 'merging should conflict for non fast-forward (resolution ex
git rev-parse --short sub-d > ../expect) &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
- test_must_fail git merge c >actual 2>sub-actual &&
+ test_env GIT_ADVICE=1 test_must_fail git merge c >actual 2>sub-actual &&
sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
grep "$sub_expect" sub-actual
else
- test_must_fail git merge c 2> actual
+ test_env GIT_ADVICE=1 test_must_fail git merge c 2> actual
fi &&
grep $(cat expect) actual > /dev/null &&
git reset --hard)
@@ -181,11 +181,11 @@ test_expect_success 'merging should fail for ambiguous common parent' '
) &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
- test_must_fail git merge c >actual 2>sub-actual &&
+ test_env GIT_ADVICE=1 test_must_fail git merge c >actual 2>sub-actual &&
sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-c)" &&
grep "$sub_expect" sub-actual
else
- test_must_fail git merge c 2> actual
+ test_env GIT_ADVICE=1 test_must_fail git merge c 2> actual
fi &&
grep $(cat expect1) actual > /dev/null &&
grep $(cat expect2) actual > /dev/null &&
@@ -227,7 +227,7 @@ test_expect_success 'merging should fail for changes that are backwards' '
git commit -a -m "f" &&
git checkout -b test-backward e &&
- test_must_fail git merge f 2>actual &&
+ test_env GIT_ADVICE=1 test_must_fail git merge f 2>actual &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short sub-d)" &&
@@ -535,7 +535,7 @@ test_expect_success 'merging should fail with no merge base' '
git checkout -b b init &&
git add sub &&
git commit -m "b" &&
- test_must_fail git merge a 2>actual &&
+ test_env GIT_ADVICE=1 test_must_fail git merge a 2>actual &&
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
then
sub_expect="go to submodule (sub), and either merge commit $(git -C sub rev-parse --short HEAD^1)" &&
diff --git a/t/t6439-merge-co-error-msgs.sh b/t/t6439-merge-co-error-msgs.sh
index 0cbec57cdab..dcc7d45ac75 100755
--- a/t/t6439-merge-co-error-msgs.sh
+++ b/t/t6439-merge-co-error-msgs.sh
@@ -40,13 +40,13 @@ Aborting
EOF
test_expect_success 'untracked files overwritten by merge (fast and non-fast forward)' '
- test_must_fail git merge branch 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git merge branch 2>out &&
test_cmp out expect &&
git commit --allow-empty -m empty &&
(
GIT_MERGE_VERBOSITY=0 &&
export GIT_MERGE_VERBOSITY &&
- test_must_fail git merge branch 2>out2
+ test_env GIT_ADVICE=1 test_must_fail git merge branch 2>out2
) &&
echo "Merge with strategy ${GIT_TEST_MERGE_ALGORITHM:-ort} failed." >>expect &&
test_cmp out2 expect &&
@@ -69,7 +69,7 @@ test_expect_success 'untracked files or local changes ovewritten by merge' '
git add two &&
git add three &&
git add four &&
- test_must_fail git merge branch 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git merge branch 2>out &&
test_cmp out expect
'
@@ -91,7 +91,7 @@ test_expect_success 'cannot switch branches because of local changes' '
git checkout main &&
echo uno >rep/one &&
echo dos >rep/two &&
- test_must_fail git checkout branch 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git checkout branch 2>out &&
test_cmp out expect
'
@@ -105,7 +105,7 @@ EOF
test_expect_success 'not uptodate file porcelain checkout error' '
git add rep/one rep/two &&
- test_must_fail git checkout branch 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git checkout branch 2>out &&
test_cmp out expect
'
@@ -136,7 +136,7 @@ test_expect_success 'not_uptodate_dir porcelain checkout error' '
git checkout main &&
>rep/untracked-file &&
>rep2/untracked-file &&
- test_must_fail git checkout branch 2>out &&
+ test_env GIT_ADVICE=1 test_must_fail git checkout branch 2>out &&
test_cmp out ../expect
'
--
gitgitgadget
next prev parent reply other threads:[~2024-08-21 11:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-21 11:02 [PATCH 0/7] [RFC] advice: refuse to output if stderr not TTY Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` [PATCH 1/7] t1000-2000: add GIT_ADVICE=1 for advice tests Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` [PATCH 2/7] t3000-4000: add GIT_ADVICE=1 to " Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` [PATCH 3/7] t5000: " Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` Derrick Stolee via GitGitGadget [this message]
2024-08-21 11:02 ` [PATCH 5/7] t7000: " Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` [PATCH 6/7] t7508/12: set GIT_ADVICE=1 across all tests Derrick Stolee via GitGitGadget
2024-08-21 11:02 ` [PATCH 7/7] advice: refuse to output if stderr not TTY Derrick Stolee via GitGitGadget
2024-08-21 15:40 ` [PATCH 0/7] [RFC] " Jeff King
2024-08-21 16:39 ` Junio C Hamano
2024-08-21 16:36 ` Junio C Hamano
2024-08-22 6:19 ` Patrick Steinhardt
2024-08-22 6:03 ` Gabor Gombas
2024-08-22 13:15 ` Derrick Stolee
2024-08-22 16:25 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ce8a8050e13fa5f24dace3ae03ff0e6a5a71aa9.1724238153.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=james@jamesliu.io \
--cc=ps@pks.im \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).