summaryrefslogtreecommitdiff
path: root/t/t7501-commit.sh
diff options
context:
space:
mode:
authorAdeodato Simó <dato@net.com.org.es>2009-01-09 17:30:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-01-11 01:45:02 (GMT)
commit7eb5bbdb645e04d746bc0edea102744f50a5e529 (patch)
treed37d6fa74195b5ed5237ca9166f400688090ca01 /t/t7501-commit.sh
parentdf3987717f1546719a1bf1828fb3714cd5ca9faa (diff)
downloadgit-7eb5bbdb645e04d746bc0edea102744f50a5e529.zip
git-7eb5bbdb645e04d746bc0edea102744f50a5e529.tar.gz
git-7eb5bbdb645e04d746bc0edea102744f50a5e529.tar.bz2
t7501-commit.sh: explicitly check that -F prevents invoking the editor
The "--signoff" test case in t7500-commit.sh was setting VISUAL while using -F -, which indeed tested that the editor is not spawned with -F. However, having it there was confusing, since there was no obvious reason to the casual reader for it to be there. This commits removes the setting of VISUAL from the --signoff test, and adds in t7501-commit.sh a dedicated test case, where the rest of tests for -F are. Signed-off-by: Adeodato Simó <dato@net.com.org.es> Okay-then-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7501-commit.sh')
-rwxr-xr-xt/t7501-commit.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 63bfc6d..b4e2b4d 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -127,6 +127,26 @@ test_expect_success \
"showing committed revisions" \
"git rev-list HEAD >current"
+cat >editor <<\EOF
+#!/bin/sh
+sed -e "s/good/bad/g" < "$1" > "$1-"
+mv "$1-" "$1"
+EOF
+chmod 755 editor
+
+cat >msg <<EOF
+A good commit message.
+EOF
+
+test_expect_success \
+ 'editor not invoked if -F is given' '
+ echo "moo" >file &&
+ VISUAL=./editor git commit -a -F msg &&
+ git show -s --pretty=format:"%s" | grep -q good &&
+ echo "quack" >file &&
+ echo "Another good message." | VISUAL=./editor git commit -a -F - &&
+ git show -s --pretty=format:"%s" | grep -q good
+ '
# We could just check the head sha1, but checking each commit makes it
# easier to isolate bugs.