rebase: pass --[no-]signoff option to git am
This makes it easy to sign off a whole patchset before submission. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0fb3c4fc9a
commit
9f79524a6a
46
t/t3428-rebase-signoff.sh
Executable file
46
t/t3428-rebase-signoff.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/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 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_done
|
Reference in New Issue
Block a user