commit-reach(get_octopus_merge_bases): pass on "missing commits" errors
[git.git] / t / t3428-rebase-signoff.sh
blobe1b1e947647462f7cbc9fb2492b2cfe127056f1e
1 #!/bin/sh
3 test_description='git rebase --signoff
5 This test runs git rebase --signoff and make sure that it works.
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 # A simple file to commit
12 cat >file <<EOF
14 EOF
16 # Expected commit message for initial commit after rebase --signoff
17 cat >expected-initial-signed <<EOF
18 Initial empty commit
20 Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
21 EOF
23 # Expected commit message after rebase --signoff
24 cat >expected-signed <<EOF
25 first
27 Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
28 EOF
30 # Expected commit message after rebase without --signoff (or with --no-signoff)
31 cat >expected-unsigned <<EOF
32 first
33 EOF
36 # We configure an alias to do the rebase --signoff so that
37 # on the next subtest we can show that --no-signoff overrides the alias
38 test_expect_success 'rebase --signoff adds a sign-off line' '
39 git commit --allow-empty -m "Initial empty commit" &&
40 git add file && git commit -m first &&
41 git config alias.rbs "rebase --signoff" &&
42 git rbs HEAD^ &&
43 git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
44 test_cmp expected-signed actual
47 test_expect_success 'rebase --no-signoff does not add a sign-off line' '
48 git commit --amend -m "first" &&
49 git rbs --no-signoff HEAD^ &&
50 git cat-file commit HEAD | sed -e "1,/^\$/d" > actual &&
51 test_cmp expected-unsigned actual
54 test_expect_success 'rebase --exec --signoff adds a sign-off line' '
55 test_when_finished "rm exec" &&
56 git commit --amend -m "first" &&
57 git rebase --exec "touch exec" --signoff HEAD^ &&
58 test_path_is_file exec &&
59 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
60 test_cmp expected-signed actual
63 test_expect_success 'rebase --root --signoff adds a sign-off line' '
64 git commit --amend -m "first" &&
65 git rebase --root --keep-empty --signoff &&
66 git cat-file commit HEAD^ | sed -e "1,/^\$/d" >actual &&
67 test_cmp expected-initial-signed actual &&
68 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
69 test_cmp expected-signed actual
72 test_expect_success 'rebase -i --signoff fails' '
73 git commit --amend -m "first" &&
74 git rebase -i --signoff HEAD^ &&
75 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
76 test_cmp expected-signed actual
79 test_expect_success 'rebase -m --signoff fails' '
80 git commit --amend -m "first" &&
81 git rebase -m --signoff HEAD^ &&
82 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
83 test_cmp expected-signed actual
85 test_done