]> git.ipfire.org Git - thirdparty/git.git/blob - t/t3428-rebase-signoff.sh
fast-import: checkpoint: dump branches/tags/marks even if object_count==0
[thirdparty/git.git] / t / t3428-rebase-signoff.sh
1 #!/bin/sh
2
3 test_description='git rebase --signoff
4
5 This test runs git rebase --signoff and make sure that it works.
6 '
7
8 . ./test-lib.sh
9
10 # A simple file to commit
11 cat >file <<EOF
12 a
13 EOF
14
15 # Expected commit message after rebase --signoff
16 cat >expected-signed <<EOF
17 first
18
19 Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
20 EOF
21
22 # Expected commit message after rebase without --signoff (or with --no-signoff)
23 cat >expected-unsigned <<EOF
24 first
25 EOF
26
27
28 # We configure an alias to do the rebase --signoff so that
29 # on the next subtest we can show that --no-signoff overrides the alias
30 test_expect_success 'rebase --signoff adds a sign-off line' '
31 git commit --allow-empty -m "Initial empty commit" &&
32 git add file && git commit -m first &&
33 git config alias.rbs "rebase --signoff" &&
34 git rbs HEAD^ &&
35 git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
36 test_cmp expected-signed actual
37 '
38
39 test_expect_success 'rebase --no-signoff does not add a sign-off line' '
40 git commit --amend -m "first" &&
41 git rbs --no-signoff HEAD^ &&
42 git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
43 test_cmp expected-unsigned actual
44 '
45
46 test_done