Skip to content

Commit

Permalink
test patch hunk editing with "commit -p -m"
Browse files Browse the repository at this point in the history
Add (failing) tests: with commit changing the environment to let hooks
know that no editor will be used (by setting GIT_EDITOR to ":"), the
"edit hunk" functionality does not work (no editor is launched and the
whole hunk is committed).

Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Benoit Pierre authored and Junio C Hamano committed Mar 18, 2014
1 parent b7ae141 commit 91c9c86
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions t/t7514-commit-patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

test_description='hunk edit with "commit -p -m"'
. ./test-lib.sh

if ! test_have_prereq PERL
then
skip_all="skipping '$test_description' tests, perl not available"
test_done
fi

test_expect_success 'setup (initial)' '
echo line1 >file &&
git add file &&
git commit -m commit1
'

test_expect_failure 'edit hunk "commit -p -m message"' '
test_when_finished "rm -f editor_was_started" &&
rm -f editor_was_started &&
echo more >>file &&
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit2 file &&
test -r editor_was_started
'

test_expect_failure 'edit hunk "commit --dry-run -p -m message"' '
test_when_finished "rm -f editor_was_started" &&
rm -f editor_was_started &&
echo more >>file &&
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit3 file &&
test -r editor_was_started
'

test_done

0 comments on commit 91c9c86

Please sign in to comment.