#!/bin/sh test_description='git merge --signoff This test runs git merge --signoff and makes sure that it works. ' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . ./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 main && test_commit main-branch-3 file3 3 && git checkout other-branch && git merge main --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 main && test_commit main-branch-4 file4 4 && git checkout other-branch && git merge main --no-edit --signoff --no-signoff && git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && test_cmp expected-unsigned actual ' test_done