Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 91c9c86

Browse files
benoit-pierregitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b7ae141 commit 91c9c86

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

t/t7514-commit-patch.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
test_description='hunk edit with "commit -p -m"'
4+
. ./test-lib.sh
5+
6+
if ! test_have_prereq PERL
7+
then
8+
skip_all="skipping '$test_description' tests, perl not available"
9+
test_done
10+
fi
11+
12+
test_expect_success 'setup (initial)' '
13+
echo line1 >file &&
14+
git add file &&
15+
git commit -m commit1
16+
'
17+
18+
test_expect_failure 'edit hunk "commit -p -m message"' '
19+
test_when_finished "rm -f editor_was_started" &&
20+
rm -f editor_was_started &&
21+
echo more >>file &&
22+
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit2 file &&
23+
test -r editor_was_started
24+
'
25+
26+
test_expect_failure 'edit hunk "commit --dry-run -p -m message"' '
27+
test_when_finished "rm -f editor_was_started" &&
28+
rm -f editor_was_started &&
29+
echo more >>file &&
30+
echo e | env GIT_EDITOR=": >editor_was_started" git commit -p -m commit3 file &&
31+
test -r editor_was_started
32+
'
33+
34+
test_done

0 commit comments

Comments
 (0)