EOF
'
-test_expect_success 'setup fake editor' '
- >fake_editor.sh &&
- chmod a+x fake_editor.sh &&
- test_set_editor "$(pwd)/fake_editor.sh"
-'
-
test_expect_success 'dummy edit works' '
+ test_set_editor : &&
(echo e; echo a) | git add -p &&
git diff > diff &&
test_cmp expected diff
'
test_expect_success 'setup fake editor' '
- echo "#!$SHELL_PATH" >fake_editor.sh &&
- cat >>fake_editor.sh <<-\EOF &&
+ write_script "fake_editor.sh" <<-\EOF &&
mv -f "$1" oldpatch &&
mv -f patch "$1"
EOF
- chmod a+x fake_editor.sh &&
test_set_editor "$(pwd)/fake_editor.sh"
'
test_expect_success 'split hunk setup' '
git reset --hard &&
- for i in 10 20 30 40 50 60
- do
- echo $i
- done >test &&
+ test_write_lines 10 20 30 40 50 60 >test &&
git add test &&
test_tick &&
git commit -m test &&
- for i in 10 15 20 21 22 23 24 30 40 50 60
- do
- echo $i
- done >test
+ test_write_lines 10 15 20 21 22 23 24 30 40 50 60 >test
'
test_expect_success 'split hunk "add -p (edit)"' '
'
test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
- cat >test <<-\EOF &&
- 5
- 10
- 20
- 21
- 30
- 31
- 40
- 50
- 60
- EOF
+ test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
git reset &&
# test sequence is s(plit), n(o), y(es), e(dit)
# q n q q is there to make sure we exit at the end.