diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-01-20 14:39:48 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-20 14:39:48 -0800 |
commit | 07301eaa766efac7818eac7a4a6db0d0c3948d66 (patch) | |
tree | e8d278300591713f61fbdcc5213dedb7d742c0f2 /t | |
parent | bd0d1916de221425fc22b69940ff71b0ce6aad9c (diff) | |
parent | c1ceea1d273925fe6ecb0824e7ea08eb6e6e2635 (diff) | |
download | git-07301eaa766efac7818eac7a4a6db0d0c3948d66.tar.gz |
Merge branch 'tr/http-push-ref-status'
* tr/http-push-ref-status:
transport-helper.c::push_refs(): emit "no refs" error message
transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed
transport.c::transport_push(): make ref status affect return value
refactor ref status logic for pushing
t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs
t5541-http-push.sh: add tests for non-fast-forward pushes
Conflicts:
transport-helper.c
Diffstat (limited to 't')
-rwxr-xr-x | t/t5541-http-push.sh | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index 2a58d0cc9c..83a8e14c6c 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -88,5 +88,49 @@ test_expect_success 'used receive-pack service' ' test_cmp exp act ' +test_expect_success 'non-fast-forward push fails' ' + cd "$ROOT_PATH"/test_repo_clone && + git checkout master && + echo "changed" > path2 && + git commit -a -m path2 --amend && + + HEAD=$(git rev-parse --verify HEAD) && + !(git push -v origin >output 2>&1) && + (cd "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git && + test $HEAD != $(git rev-parse --verify HEAD)) +' + +test_expect_success 'non-fast-forward push show ref status' ' + grep "^ ! \[rejected\][ ]*master -> master (non-fast-forward)$" output +' + +test_expect_success '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 '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 +Merge the remote changes before pushing again. See the '"'non-fast-forward'"' +section of '"'git push --help'"' for details." output +' + stop_httpd test_done |