Merge branch 'sb/color-h-cleanup'
[git/debian.git] / t / t3428-rebase-signoff.sh
blob2afb56470184b18da19740f0a68abb31da96fd82
1 #!/bin/sh
3 test_description='git rebase --signoff
5 This test runs git rebase --signoff and make sure that it works.
8 . ./test-lib.sh
10 # A simple file to commit
11 cat >file <<EOF
13 EOF
15 # Expected commit message after rebase --signoff
16 cat >expected-signed <<EOF
17 first
19 Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
20 EOF
22 # Expected commit message after rebase without --signoff (or with --no-signoff)
23 cat >expected-unsigned <<EOF
24 first
25 EOF
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
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
46 test_done