git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 35a4d0610602dddcd2e32edadf59966ebd353276 2032 bytes (raw)
name: t/t7507-commit-verbose.sh 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
#!/bin/sh

test_description='verbose commit template'
. ./test-lib.sh

write_script check-for-diff <<-'EOF'
	exec grep '^diff --git' "$1"
EOF

cat >message <<'EOF'
subject

body
EOF

test_expect_success 'setup' '
	echo content >file &&
	git add file &&
	git commit -F message
'

test_expect_success 'initial commit shows verbose diff' '
	test_set_editor "$PWD/check-for-diff" &&
	git commit --amend -v
'

test_expect_success 'second commit' '
	echo content modified >file &&
	git add file &&
	git commit -F message
'

check_message() {
	git log -1 --pretty=format:%s%n%n%b >actual &&
	test_cmp "$1" actual
}

test_expect_success 'verbose diff is stripped out' '
	test_set_editor "$PWD/check-for-diff" &&
	git commit --amend -v &&
	check_message message
'

test_expect_success 'verbose diff is stripped out (mnemonicprefix)' '
	test_set_editor "$PWD/check-for-diff" &&
	test_config diff.mnemonicprefix true &&
	git commit --amend -v &&
	check_message message
'

cat >diff <<'EOF'
This is an example commit message that contains a diff.

diff --git c/file i/file
new file mode 100644
index 0000000..f95c11d
--- /dev/null
+++ i/file
@@ -0,0 +1 @@
+this is some content
EOF

test_expect_success 'diff in message is retained without -v' '
	git commit --amend -F diff &&
	check_message diff
'

test_expect_success 'diff in message is retained with -v' '
	git commit --amend -F diff -v &&
	check_message diff
'

test_expect_success 'submodule log is stripped out too with -v' '
	test_config diff.submodule log &&
	git submodule add ./. sub &&
	git commit -m "sub added" &&
	(
		cd sub &&
		echo "more" >>file &&
		git commit -a -m "submodule commit"
	) &&
	test_set_editor cat &&
	test_must_fail git commit -a -v 2>err &&
	test_i18ngrep "Aborting commit due to empty commit message." err
'

test_expect_success 'verbose diff is stripped out with set core.commentChar' '
	test_set_editor cat &&
	test_must_fail git -c core.commentchar=";" commit -a -v 2>err &&
	test_i18ngrep "Aborting commit due to empty commit message." err
'

test_done

debug log:

solving 35a4d06 ...
found 35a4d06 in https://public-inbox.org/git/1402511079-17735-4-git-send-email-caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1402601942-45553-4-git-send-email-caleb@calebthompson.io/ ||
	https://public-inbox.org/git/41484002d48514cc6eefc1bebbf6fea8d0f93a40.1403033723.git.caleb@calebthompson.io/
found db09107 in https://public-inbox.org/git/fa7260f688bccac09138c8ef5ef1982cee0f0dde.1403033723.git.caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1402511079-17735-3-git-send-email-caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1402601942-45553-3-git-send-email-caleb@calebthompson.io/
found 6d778ed in https://public-inbox.org/git/a7aa2efcb6a2beba973c389f5c7afbce79ec9747.1403033723.git.caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1401130586-93105-2-git-send-email-caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1402511079-17735-2-git-send-email-caleb@calebthompson.io/ ||
	https://public-inbox.org/git/1402601942-45553-2-git-send-email-caleb@calebthompson.io/
found 2ddf28c in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 2ddf28c984de99cb17884f76d68a708076f57e12	t/t7507-commit-verbose.sh

applying [1/3] https://public-inbox.org/git/a7aa2efcb6a2beba973c389f5c7afbce79ec9747.1403033723.git.caleb@calebthompson.io/
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 2ddf28c..6d778ed 100755

Checking patch t/t7507-commit-verbose.sh...
Applied patch t/t7507-commit-verbose.sh cleanly.

skipping https://public-inbox.org/git/1401130586-93105-2-git-send-email-caleb@calebthompson.io/ for 6d778ed
skipping https://public-inbox.org/git/1402511079-17735-2-git-send-email-caleb@calebthompson.io/ for 6d778ed
skipping https://public-inbox.org/git/1402601942-45553-2-git-send-email-caleb@calebthompson.io/ for 6d778ed
index at:
100755 6d778ed77c344eb6e30ca7f3aae182d9cfb85efb	t/t7507-commit-verbose.sh

applying [2/3] https://public-inbox.org/git/fa7260f688bccac09138c8ef5ef1982cee0f0dde.1403033723.git.caleb@calebthompson.io/
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 6d778ed..db09107 100755

Checking patch t/t7507-commit-verbose.sh...
Applied patch t/t7507-commit-verbose.sh cleanly.

skipping https://public-inbox.org/git/1402511079-17735-3-git-send-email-caleb@calebthompson.io/ for db09107
skipping https://public-inbox.org/git/1402601942-45553-3-git-send-email-caleb@calebthompson.io/ for db09107
index at:
100755 db091079ced13d31cfad1aca212a89162508376f	t/t7507-commit-verbose.sh

applying [3/3] https://public-inbox.org/git/1402511079-17735-4-git-send-email-caleb@calebthompson.io/
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index db09107..35a4d06 100755

error: corrupt patch at line 7

git apply error:; exit status=128
trying https://public-inbox.org/git/1402601942-45553-4-git-send-email-caleb@calebthompson.io/

applying [4/3] https://public-inbox.org/git/1402601942-45553-4-git-send-email-caleb@calebthompson.io/
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index db09107..35a4d06 100755

Checking patch t/t7507-commit-verbose.sh...
Applied patch t/t7507-commit-verbose.sh cleanly.

skipping https://public-inbox.org/git/41484002d48514cc6eefc1bebbf6fea8d0f93a40.1403033723.git.caleb@calebthompson.io/ for 35a4d06
index at:
100755 35a4d0610602dddcd2e32edadf59966ebd353276	t/t7507-commit-verbose.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).