X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5541-http-push.sh;h=53f54a2789557bcfd4e9843b50fe28189fa6f356;hb=cc8eb6407e88a46da6d41e18cffed3878f2c53cf;hp=f49c7c4178c9c6ab098f73cbed799868ee40fa31;hpb=1945237486851bc3a0c6d65eaeb21cb22cac2ea1;p=git.git diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index f49c7c417..53f54a278 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -100,15 +100,32 @@ test_expect_success 'non-fast-forward push fails' ' test $HEAD != $(git rev-parse --verify HEAD)) ' -test_expect_failure 'non-fast-forward push show ref status' ' +test_expect_success 'non-fast-forward push show ref status' ' grep "^ ! \[rejected\][ ]*master -> master (non-fast-forward)$" output ' -test_expect_failure 'non-fast-forward push shows help message' ' - grep \ -"To prevent you from losing history, non-fast-forward updates were rejected -Merge the remote changes before pushing again. See the '"'non-fast-forward'"' -section of '"'git push --help'"' for details." output +test_expect_success 'non-fast-forward push shows help message' ' + grep "To prevent you from losing history, non-fast-forward updates were rejected" \ + output +' + +test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' ' + # create a dissimilarly-named remote ref so that git is unable to match the + # two refs (viz. local, remote) unless an explicit refspec is provided. + git push origin master:retsam + + echo "change changed" > path2 && + git commit -a -m path2 --amend && + + # push master too; this ensures there is at least one '"'push'"' command to + # the remote helper and triggers interaction with the helper. + !(git push -v origin +master master:retsam >output 2>&1) && + + grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output && + grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output && + + grep "To prevent you from losing history, non-fast-forward updates were rejected" \ + output ' stop_httpd