@matheusbsbs / matheus-bagliano / commits / 7eb5bbdb64
Fork 0

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>

Adeodato Simó committed Jan 9, 2009 at 18:30 UTC 7eb5bbdb645e04d746bc0edea102744f50a5e529
2 files changed +21 -4
t/t7500-commit.sh
+1 -4
@@ -149,10 +149,7 @@ EOF
149
150 test_expect_success '--signoff' '
151 echo "yet another content *narf*" >> foo &&
152 - echo "zort" | (
153 - test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
154 - git commit -s -F - foo
155 - ) &&
152 + echo "zort" | git commit -s -F - foo &&
153 git cat-file commit HEAD | sed "1,/^$/d" > output &&
154 test_cmp expect output
155 '
t/t7501-commit.sh
+20
@@ -127,6 +127,26 @@ test_expect_success \
127 "showing committed revisions" \
128 "git rev-list HEAD >current"
129
130 +cat >editor <<\EOF
131 +#!/bin/sh
132 +sed -e "s/good/bad/g" < "$1" > "$1-"
133 +mv "$1-" "$1"
134 +EOF
135 +chmod 755 editor
136 +
137 +cat >msg <<EOF
138 +A good commit message.
139 +EOF
140 +
141 +test_expect_success \
142 + 'editor not invoked if -F is given' '
143 + echo "moo" >file &&
144 + VISUAL=./editor git commit -a -F msg &&
145 + git show -s --pretty=format:"%s" | grep -q good &&
146 + echo "quack" >file &&
147 + echo "Another good message." | VISUAL=./editor git commit -a -F - &&
148 + git show -s --pretty=format:"%s" | grep -q good
149 + '
150 # We could just check the head sha1, but checking each commit makes it
151 # easier to isolate bugs.
152