git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 90ca6636d5f3afa624a48d02d148d90bc13ee364 2191 bytes (raw)
name: t/t3428-rebase-signoff.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
 
#!/bin/sh

test_description='git rebase --signoff

This test runs git rebase --signoff and make sure that it works.
'

. ./test-lib.sh

# A simple file to commit
cat >file <<EOF
a
EOF

# Expected commit message for initial commit after rebase --signoff
cat >expected-initial-signed <<EOF
Initial empty commit

Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
EOF

# Expected commit message after rebase --signoff
cat >expected-signed <<EOF
first

Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
EOF

# Expected commit message after rebase without --signoff (or with --no-signoff)
cat >expected-unsigned <<EOF
first
EOF


# We configure an alias to do the rebase --signoff so that
# on the next subtest we can show that --no-signoff overrides the alias
test_expect_success 'rebase --signoff adds a sign-off line' '
	git commit --allow-empty -m "Initial empty commit" &&
	git add file && git commit -m first &&
	git config alias.rbs "rebase --signoff" &&
	git rbs HEAD^ &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	test_cmp expected-signed actual
'

test_expect_success 'rebase --no-signoff does not add a sign-off line' '
	git commit --amend -m "first" &&
	git rbs --no-signoff HEAD^ &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
	test_cmp expected-unsigned actual
'

test_expect_success 'rebase --exec --signoff adds a sign-off line' '
	test_when_finished "rm exec" &&
	git commit --amend -m "first" &&
	git rebase --exec "touch exec" --signoff HEAD^ &&
	test_path_is_file exec &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
	test_cmp expected-signed actual
'

test_expect_success 'rebase --root --signoff adds a sign-off line' '
	git commit --amend -m "first" &&
	git rebase --root --keep-empty --signoff &&
	git cat-file commit HEAD^ | sed -e "1,/^\$/d" >actual &&
	test_cmp expected-initial-signed actual &&
	git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
	test_cmp expected-signed actual
'

test_expect_success 'rebase -i --signoff fails' '
	test_must_fail git rebase -i --signoff HEAD^
'

test_expect_success 'rebase -m --signoff fails' '
	test_must_fail git rebase -m --signoff HEAD^
'
test_done

debug log:

solving 90ca6636d5 ...
found 90ca6636d5 in https://public-inbox.org/git/20180314111127.14217-2-phillip.wood@talktalk.net/
found 2ff7f534e3 in https://public-inbox.org/git/20180314111127.14217-1-phillip.wood@talktalk.net/
found 2afb564701 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 2afb56470184b18da19740f0a68abb31da96fd82	t/t3428-rebase-signoff.sh

applying [1/2] https://public-inbox.org/git/20180314111127.14217-1-phillip.wood@talktalk.net/
diff --git a/t/t3428-rebase-signoff.sh b/t/t3428-rebase-signoff.sh
index 2afb564701..2ff7f534e3 100755


applying [2/2] https://public-inbox.org/git/20180314111127.14217-2-phillip.wood@talktalk.net/
diff --git a/t/t3428-rebase-signoff.sh b/t/t3428-rebase-signoff.sh
index 2ff7f534e3..90ca6636d5 100755

Checking patch t/t3428-rebase-signoff.sh...
Applied patch t/t3428-rebase-signoff.sh cleanly.
Checking patch t/t3428-rebase-signoff.sh...
Applied patch t/t3428-rebase-signoff.sh cleanly.

index at:
100755 90ca6636d5f3afa624a48d02d148d90bc13ee364	t/t3428-rebase-signoff.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).