#!/bin/sh
test_description='git merge --signoff
This test runs git merge --signoff and makes sure that it works.
'
. ./test-lib.sh
# Setup test files
test_setup() {
	# Expected commit message after merge --signoff
	cat >expected-signed <.*/>/")
EOF
	# Expected commit message after merge without --signoff (or with --no-signoff)
	cat >expected-unsigned <actual &&
	test_cmp expected-signed actual
'
# Test without --signoff flag
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 for --no-signoff flag
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