File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,51 @@ test_description='git commit porcelain-ish'
4
4
5
5
. ./test-lib.sh
6
6
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
+
7
48
test_expect_success ' the basics' '
8
49
50
+ output_tests_cleanup &&
51
+
9
52
echo doing partial >"commit is" &&
10
53
mkdir not &&
11
54
echo very much encouraged but we should >not/forbid &&
You can’t perform that action at this time.
0 commit comments