summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-26 17:35:38 -0800
committerJunio C Hamano <gitster@pobox.com>2007-12-26 17:35:38 -0800
commit97d0c52980f0e64f0feed5b31390a32561df0ecf (patch)
treeec72aea1584b88cc846f5b39c12d530b354dcd67 /t
parentd56250911f4ec074048f4edb34551eaf384172cc (diff)
parent5f0657374344a5d8cf5ce5a9920a08c0be422194 (diff)
downloadgit-97d0c52980f0e64f0feed5b31390a32561df0ecf.tar.gz
Merge branch 'ar/commit-cleanup'
* ar/commit-cleanup: Allow selection of different cleanup modes for commit messages builtin-commit: avoid double-negation in the code. builtin-commit: fix amending of the initial commit t7005: do not exit inside test.
Diffstat (limited to 't')
-rwxr-xr-xt/t7005-editor.sh2
-rwxr-xr-xt/t7502-commit.sh65
2 files changed, 66 insertions, 1 deletions
diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
index 44228b5ac1..c1cec55306 100755
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -37,7 +37,7 @@ test_expect_success 'dumb should error out when falling back on vi' '
if git commit --amend
then
echo "Oops?"
- exit 1
+ false
else
: happy
fi
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 21ac785e3d..aaf497e6a5 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -89,4 +89,69 @@ test_expect_success 'verbose' '
'
+test_expect_success 'cleanup commit messages (verbatim,-t)' '
+
+ echo >>negative &&
+ { echo;echo "# text";echo; } >expect &&
+ git commit --cleanup=verbatim -t expect -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d" |head -n 3 >actual &&
+ diff -u expect actual
+
+'
+
+test_expect_success 'cleanup commit messages (verbatim,-F)' '
+
+ echo >>negative &&
+ git commit --cleanup=verbatim -F expect -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
+ diff -u expect actual
+
+'
+
+test_expect_success 'cleanup commit messages (verbatim,-m)' '
+
+ echo >>negative &&
+ git commit --cleanup=verbatim -m "$(cat expect)" -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
+ diff -u expect actual
+
+'
+
+test_expect_success 'cleanup commit messages (whitespace,-F)' '
+
+ echo >>negative &&
+ { echo;echo "# text";echo; } >text &&
+ echo "# text" >expect &&
+ git commit --cleanup=whitespace -F text -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
+ diff -u expect actual
+
+'
+
+test_expect_success 'cleanup commit messages (strip,-F)' '
+
+ echo >>negative &&
+ { echo;echo "# text";echo sample;echo; } >text &&
+ echo sample >expect &&
+ git commit --cleanup=strip -F text -a &&
+ git cat-file -p HEAD |sed -e "1,/^\$/d">actual &&
+ diff -u expect actual
+
+'
+
+echo "sample
+
+# Please enter the commit message for your changes.
+# (Comment lines starting with '#' will not be included)" >expect
+
+test_expect_success 'cleanup commit messages (strip,-F,-e)' '
+
+ echo >>negative &&
+ { echo;echo sample;echo; } >text &&
+ git commit -e -F text -a &&
+ head -n 4 .git/COMMIT_EDITMSG >actual &&
+ diff -u expect actual
+
+'
+
test_done