t7614-merge-signoff.sh [plain text]
#!/bin/sh
test_description='git merge --signoff
This test runs git merge --signoff and makes sure that it works.
'
. ./test-lib.sh
test_setup() {
cat >expected-signed <<EOF &&
Merge branch 'master' into other-branch
Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
EOF
cat >expected-unsigned <<EOF &&
Merge branch 'master' into other-branch
EOF
git commit --allow-empty -m "Initial empty commit" &&
git checkout -b other-branch &&
test_commit other-branch file1 1
}
test_expect_success 'setup' '
test_setup
'
test_expect_success 'git merge --signoff adds a sign-off line' '
git checkout master &&
test_commit master-branch-2 file2 2 &&
git checkout other-branch &&
git merge master --signoff --no-edit &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-signed actual
'
test_expect_success 'git merge does not add a sign-off line' '
git checkout master &&
test_commit master-branch-3 file3 3 &&
git checkout other-branch &&
git merge master --no-edit &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-unsigned actual
'
test_expect_success 'git merge --no-signoff flag cancels --signoff flag' '
git checkout master &&
test_commit master-branch-4 file4 4 &&
git checkout other-branch &&
git merge master --no-edit --signoff --no-signoff &&
git cat-file commit HEAD | sed -e "1,/^\$/d" >actual &&
test_cmp expected-unsigned actual
'
test_done