From: Junio C Hamano Date: Wed, 24 Jun 2026 22:42:59 GMT Subject: Re: [PATCH v2 2/2] push: suggest for a slash slip Message-ID: In-Reply-To: <49de5a925de506ed9a141eb72927b2548b73af22.1782338114.git.gitgitgadget@gmail.com> "Harald Nordgren via GitGitGadget" writes: > diff --git a/t/t5529-push-errors.sh b/t/t5529-push-errors.sh > index 80b06a0cd2..cfb294305d 100755 > --- a/t/t5529-push-errors.sh > +++ b/t/t5529-push-errors.sh > @@ -54,6 +54,37 @@ test_expect_success 'detect empty remote with targeted refspec' ' > grep "fatal: bad repository ${SQ}${SQ}" stderr > ' > > +test_expect_success 'suggest for a / slip' ' > + test_must_fail git push origin/main 2>stderr && > + grep "${SQ}origin/main${SQ} is not a valid push target" stderr && > + grep "hint: Did you mean to use: git push origin main?" stderr && > + test_must_fail git -c advice.pushRepoLooksLikeRef=false push origin/main 2>stderr && > + ! grep "Did you mean" stderr > +' > + > +test_expect_success 'suggest when the branch has slashes' ' > + test_must_fail git push origin/feature/x 2>stderr && > + grep "hint: Did you mean to use: git push origin feature/x?" stderr > +' > + > +test_expect_success 'no suggestion when prefix is not a configured remote' ' > + test_must_fail git push not-a-remote/main 2>stderr && > + ! grep "Did you mean" stderr > +' > + > +test_expect_success 'no suggestion for a trailing slash with no branch' ' > + test_must_fail git push origin/ 2>stderr && > + ! grep "Did you mean" stderr > +' t5529-push-errors.sh:59: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:60: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:62: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:67: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:72: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:77: error: bare grep outside pipeline (use test_grep) t5529-push-errors.sh:84: error: bare grep outside pipeline (use test_grep)