From: Junio C Hamano Date: Fri, 22 Apr 2016 22:45:09 +0000 (-0700) Subject: Merge branch 'jk/use-write-script-more' X-Git-Tag: v2.9.0-rc0~103 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2416803b6cea2bc56ea29fe767a916572f2fc89e?ds=inline;hp=-c Merge branch 'jk/use-write-script-more' Code clean-up. * jk/use-write-script-more: t3404: use write_script t1020: do not overuse printf and use write_script t5532: use write_script --- 2416803b6cea2bc56ea29fe767a916572f2fc89e diff --combined t/t3404-rebase-interactive.sh index b79f442acf,d6d65a3a94..d96d0e4c9b --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@@ -555,10 -555,9 +555,9 @@@ test_expect_success 'rebase a detached test_expect_success 'rebase a commit violating pre-commit' ' mkdir -p .git/hooks && - PRE_COMMIT=.git/hooks/pre-commit && - echo "#!/bin/sh" > $PRE_COMMIT && - echo "test -z \"\$(git diff --cached --check)\"" >> $PRE_COMMIT && - chmod a+x $PRE_COMMIT && + write_script .git/hooks/pre-commit <<-\EOF && + test -z "$(git diff --cached --check)" + EOF echo "monde! " >> file1 && test_tick && test_must_fail git commit -m doesnt-verify file1 && @@@ -771,6 -770,7 +770,6 @@@ test_expect_success 'rebase-i history w test_cmp expect actual ' - test_expect_success 'prepare for rebase -i --exec' ' git checkout master && git checkout -b execute && @@@ -779,6 -779,7 +778,6 @@@ test_commit three_exec main.txt three_exec ' - test_expect_success 'running "git rebase -i --exec git show HEAD"' ' set_fake_editor && git rebase -i --exec "git show HEAD" HEAD~2 >actual && @@@ -791,6 -792,7 +790,6 @@@ test_cmp expected actual ' - test_expect_success 'running "git rebase --exec git show HEAD -i"' ' git reset --hard execute && set_fake_editor && @@@ -804,6 -806,7 +803,6 @@@ test_cmp expected actual ' - test_expect_success 'running "git rebase -ix git show HEAD"' ' git reset --hard execute && set_fake_editor && @@@ -831,6 -834,7 +830,6 @@@ test_expect_success 'rebase -ix with se test_cmp expected actual ' - test_expect_success 'rebase -ix with several instances of --exec' ' git reset --hard execute && set_fake_editor && @@@ -845,6 -849,7 +844,6 @@@ test_cmp expected actual ' - test_expect_success 'rebase -ix with --autosquash' ' git reset --hard execute && git checkout -b autosquash && @@@ -870,15 -875,16 +869,15 @@@ test_cmp expected actual ' - -test_expect_success 'rebase --exec without -i shows error message' ' +test_expect_success 'rebase --exec works without -i ' ' git reset --hard execute && - set_fake_editor && - test_must_fail git rebase --exec "git show HEAD" HEAD~2 2>actual && - echo "The --exec option must be used with the --interactive option" >expected && - test_i18ncmp expected actual + rm -rf exec_output && + EDITOR="echo >invoked_editor" git rebase --exec "echo a line >>exec_output" HEAD~2 2>actual && + test_i18ngrep "Successfully rebased and updated" actual && + test_line_count = 2 exec_output && + test_path_is_missing invoked_editor ' - test_expect_success 'rebase -i --exec without ' ' git reset --hard execute && set_fake_editor &&