File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,8 +4,51 @@ test_description='git commit porcelain-ish'
44
55. ./test-lib.sh
66
7+ # Arguments: [<prefix] [<commit message>]
8+ check_summary_oneline () {
9+ test_tick &&
10+ git commit -m " $2 " | head -1 > act &&
11+
12+ # branch name
13+ SUMMARY_PREFIX=" $( git name-rev --name-only HEAD) " &&
14+
15+ # append the "special" prefix, like "root-commit", "detached HEAD"
16+ if test -n " $1 "
17+ then
18+ SUMMARY_PREFIX=" $SUMMARY_PREFIX ($1 )"
19+ fi
20+
21+ # abbrev SHA-1
22+ SUMMARY_POSTFIX=" $( git log -1 --pretty=' format:%h' ) "
23+ echo " [$SUMMARY_PREFIX $SUMMARY_POSTFIX ] $2 " > exp &&
24+
25+ test_cmp exp act
26+ }
27+
28+ test_expect_success ' output summary format' '
29+
30+ echo new >file1 &&
31+ git add file1 &&
32+ check_summary_oneline "root-commit" "initial" &&
33+
34+ echo change >>file1 &&
35+ git add file1 &&
36+ check_summary_oneline "" "a change"
37+ '
38+
39+ output_tests_cleanup () {
40+ # this is needed for "do not fire editor in the presence of conflicts"
41+ git checkout master &&
42+
43+ # this is needed for the "partial removal" test to pass
44+ git rm file1 &&
45+ git commit -m " cleanup"
46+ }
47+
748test_expect_success ' the basics' '
849
50+ output_tests_cleanup &&
51+
952 echo doing partial >"commit is" &&
1053 mkdir not &&
1154 echo very much encouraged but we should >not/forbid &&
You can’t perform that action at this time.
0 commit comments