@@ -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 &&
@@ -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 ||
@@ -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
'
@@ -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 &&