Skip to content

Commit

Permalink
t7501-commit.sh: explicitly check that -F prevents invoking the editor
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adeodato Simó authored and Junio C Hamano committed Jan 11, 2009
1 parent df39877 commit 7eb5bbd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
5 changes: 1 addition & 4 deletions t/t7500-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ EOF

test_expect_success '--signoff' '
echo "yet another content *narf*" >> foo &&
echo "zort" | (
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit -s -F - foo
) &&
echo "zort" | git commit -s -F - foo &&
git cat-file commit HEAD | sed "1,/^$/d" > output &&
test_cmp expect output
'
Expand Down
20 changes: 20 additions & 0 deletions t/t7501-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 7eb5bbd

Please sign in to comment.