Skip to content

Commit

Permalink
Merge branch 'sg/t6050-failing-editor-test-fix' into maint
Browse files Browse the repository at this point in the history
* sg/t6050-failing-editor-test-fix:
  t6050-replace: make failing editor test more robust
  • Loading branch information
Junio C Hamano committed Feb 5, 2016
2 parents 01517bd + 36fc7d8 commit 0298675
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions t/t6050-replace.sh
Original file line number Diff line number Diff line change
@@ -351,11 +351,15 @@ test_expect_success 'test --format long' '
test_cmp expected actual
'

test_expect_success 'setup a fake editor' '
write_script fakeeditor <<-\EOF
test_expect_success 'setup fake editors' '
write_script fakeeditor <<-\EOF &&
sed -e "s/A U Thor/A fake Thor/" "$1" >"$1.new"
mv "$1.new" "$1"
EOF
write_script failingfakeeditor <<-\EOF
./fakeeditor "$@"
false
EOF
'

test_expect_success '--edit with and without already replaced object' '
@@ -372,7 +376,7 @@ test_expect_success '--edit with and without already replaced object' '
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" &&
test_must_fail env GIT_EDITOR="./failingfakeeditor" 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"

0 comments on commit 0298675

Please sign in to comment.