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 3/7] t5000: add GIT_ADVICE=1 to advice tests
Date: Wed, 21 Aug 2024 11:02:28 +0000 [thread overview]
Message-ID: <970964550ab519c9a8070fada116951bfe04f75d.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.
In particular, lib-https.sh must be updated in order for t5541 to succeed as
it calls test_http_push_nonff.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
---
t/lib-httpd.sh | 2 +-
t/t5505-remote.sh | 5 +++--
t/t5520-pull.sh | 4 ++--
t/t5541-http-push-smart.sh | 6 ++++--
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index d83bafeab32..b85ce907f05 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -265,7 +265,7 @@ test_http_push_nonff () {
echo "changed" > path2 &&
git commit -a -m path2 --amend &&
- test_must_fail git push -v origin >output 2>&1 &&
+ test_env GIT_ADVICE=1 test_must_fail git push -v origin >output 2>&1 &&
(
cd "$REMOTE_REPO" &&
echo "$HEAD" >expect &&
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 08424e878e1..3e5215add31 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -1452,10 +1452,11 @@ test_expect_success 'unqualified <dst> refspec DWIM and advice' '
else
oid=$(git rev-parse some-tag^{$type})
fi &&
- test_must_fail git push origin $oid:dst 2>err &&
+ test_env GIT_ADVICE=1 test_must_fail git push origin $oid:dst 2>err &&
test_grep "error: The destination you" err &&
test_grep "hint: Did you mean" err &&
- test_must_fail git -c advice.pushUnqualifiedRefName=false \
+ test_env GIT_ADVICE=1 test_must_fail git \
+ -c advice.pushUnqualifiedRefName=false \
push origin $oid:dst 2>err &&
test_grep "error: The destination you" err &&
test_grep ! "hint: Did you mean" err ||
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 1098cbd0a19..c4a309ce4ae 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -375,7 +375,7 @@ test_expect_success '--rebase with conflicts shows advice' '
echo conflicting >>seq.txt &&
test_tick &&
git commit -m "Create conflict" seq.txt &&
- test_must_fail git pull --rebase . seq 2>err >out &&
+ test_env GIT_ADVICE=1 test_must_fail git pull --rebase . seq 2>err >out &&
test_grep "Resolve all conflicts manually" err
'
@@ -389,7 +389,7 @@ test_expect_success 'failed --rebase shows advice' '
# force checkout because `git reset --hard` will not leave clean `file`
git checkout -f -b fails-to-rebase HEAD^ &&
test_commit v2-without-cr file "2" file2-lf &&
- test_must_fail git pull --rebase . diverging 2>err >out &&
+ test_env GIT_ADVICE=1 test_must_fail git pull --rebase . diverging 2>err >out &&
test_grep "Resolve all conflicts manually" err
'
diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
index 71428f3d5c7..dfd4c21808f 100755
--- a/t/t5541-http-push-smart.sh
+++ b/t/t5541-http-push-smart.sh
@@ -145,7 +145,7 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
# push main too; this ensures there is at least one '"'push'"' command to
# the remote helper and triggers interaction with the helper.
- test_must_fail git push -v origin +main main:niam >output 2>&1'
+ test_env GIT_ADVICE=1 test_must_fail git push -v origin +main main:niam >output 2>&1'
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *main -> main (forced update)$" output &&
@@ -477,7 +477,9 @@ test_expect_success 'Non-ASCII branch name can be used with --force-with-lease'
test_expect_success 'colorize errors/hints' '
cd "$ROOT_PATH"/test_repo_clone &&
- test_must_fail git -c color.transport=always -c color.advice=always \
+ test_env GIT_ADVICE=1 test_must_fail git \
+ -c color.transport=always \
+ -c color.advice=always \
-c color.push=always \
push origin origin/main^:main 2>act &&
test_decode_color <act >decoded &&
--
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 ` Derrick Stolee via GitGitGadget [this message]
2024-08-21 11:02 ` [PATCH 4/7] t6000: " Derrick Stolee via GitGitGadget
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=970964550ab519c9a8070fada116951bfe04f75d.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).