summaryrefslogtreecommitdiff
path: root/t/t7514-commit-patch.sh
diff options
context:
space:
mode:
authorBenoit Pierre <benoit.pierre@gmail.com>2014-03-18 11:00:52 +0100
committerJunio C Hamano <gitster@pobox.com>2014-03-18 11:24:39 -0700
commit91c9c8692056c0553c6ea9239ccd46f7f3dbd877 (patch)
treed8a0e9873794f11e53385e0be8f95b1995d312ed /t/t7514-commit-patch.sh
parentb7ae14148fc44223b4ffaff5ccbf3227a0af8f3c (diff)
downloadgit-91c9c8692056c0553c6ea9239ccd46f7f3dbd877.tar.gz
test patch hunk editing with "commit -p -m"
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>
Diffstat (limited to 't/t7514-commit-patch.sh')
-rwxr-xr-xt/t7514-commit-patch.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t7514-commit-patch.sh b/t/t7514-commit-patch.sh
new file mode 100755
index 0000000000..41dd37af75
--- /dev/null
+++ b/t/t7514-commit-patch.sh
@@ -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