diff options
author | Christian Couder <chriscool@tuxfamily.org> | 2014-05-17 14:16:37 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-05-19 13:39:53 -0700 |
commit | 85f98fc037ae026596c5d3b5d71fbfaa9144f210 (patch) | |
tree | 71a0193dc2d6af30cc97797a3762663d39f25588 /t/t6050-replace.sh | |
parent | 24790835738dc098fa6becedc44aac0341b7d5af (diff) | |
download | git-85f98fc037ae026596c5d3b5d71fbfaa9144f210.tar.gz git-85f98fc037ae026596c5d3b5d71fbfaa9144f210.tar.xz |
replace: add tests for --edit
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6050-replace.sh')
-rwxr-xr-x | t/t6050-replace.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh index 719a11673..68b3cb26d 100755 --- a/t/t6050-replace.sh +++ b/t/t6050-replace.sh @@ -318,6 +318,33 @@ test_expect_success 'test --format long' ' test_cmp expected actual ' +test_expect_success 'setup a fake editor' ' + write_script fakeeditor <<-\EOF + sed -e "s/A U Thor/A fake Thor/" "$1" >"$1.new" + mv "$1.new" "$1" + EOF +' + +test_expect_success '--edit with and without already replaced object' ' + test_must_fail env GIT_EDITOR=./fakeeditor git replace --edit "$PARA3" && + GIT_EDITOR=./fakeeditor git replace --force --edit "$PARA3" && + git replace -l | grep "$PARA3" && + git cat-file commit "$PARA3" | grep "A fake Thor" && + git replace -d "$PARA3" && + GIT_EDITOR=./fakeeditor git replace --edit "$PARA3" && + git replace -l | grep "$PARA3" && + git cat-file commit "$PARA3" | grep "A fake Thor" +' + +test_expect_success '--edit and change nothing or command failed' ' + git replace -d "$PARA3" && + test_must_fail env GIT_EDITOR=true git replace --edit "$PARA3" && + test_must_fail env GIT_EDITOR="./fakeeditor;false" git replace --edit "$PARA3" && + GIT_EDITOR=./fakeeditor git replace --edit "$PARA3" && + git replace -l | grep "$PARA3" && + git cat-file commit "$PARA3" | grep "A fake Thor" +' + test_expect_success 'replace ref cleanup' ' test -n "$(git replace)" && git replace -d $(git replace) && |