summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c197702)
raw | patch | inline | side by side (parent: c197702)
author | Tay Ray Chuan <rctay89@gmail.com> | |
Thu, 27 May 2010 15:34:50 +0000 (23:34 +0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 28 May 2010 22:35:00 +0000 (15:35 -0700) |
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7502-commit.sh | patch | blob | history |
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 844fb43c6db1ae4e9b8a3cda6156af359e9f639e..478b637b0c82fa7145bfbf4297e1fa14bd118271 100755 (executable)
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
. ./test-lib.sh
+# Arguments: [<prefix] [<commit message>]
+check_summary_oneline() {
+ test_tick &&
+ git commit -m "$2" | head -1 > act &&
+
+ # branch name
+ SUMMARY_PREFIX="$(git name-rev --name-only HEAD)" &&
+
+ # append the "special" prefix, like "root-commit", "detached HEAD"
+ if test -n "$1"
+ then
+ SUMMARY_PREFIX="$SUMMARY_PREFIX ($1)"
+ fi
+
+ # abbrev SHA-1
+ SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
+ echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
+
+ test_cmp exp act
+}
+
+test_expect_success 'output summary format' '
+
+ echo new >file1 &&
+ git add file1 &&
+ check_summary_oneline "root-commit" "initial" &&
+
+ echo change >>file1 &&
+ git add file1 &&
+ check_summary_oneline "" "a change"
+'
+
+output_tests_cleanup() {
+ # this is needed for "do not fire editor in the presence of conflicts"
+ git checkout master &&
+
+ # this is needed for the "partial removal" test to pass
+ git rm file1 &&
+ git commit -m "cleanup"
+}
+
test_expect_success 'the basics' '
+ output_tests_cleanup &&
+
echo doing partial >"commit is" &&
mkdir not &&
echo very much encouraged but we should >not/forbid &&