Git fork
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at reftables-rust 72 lines 2.0 kB view raw
1#!/bin/sh 2 3test_description='git merge --signoff 4 5This test runs git merge --signoff and makes sure that it works. 6' 7 8GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11. ./test-lib.sh 12 13# Setup test files 14test_setup() { 15 # Expected commit message after merge --signoff 16 cat >expected-signed <<EOF && 17Merge branch 'main' into other-branch 18 19Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/") 20EOF 21 22 # Expected commit message after merge without --signoff (or with --no-signoff) 23 cat >expected-unsigned <<EOF && 24Merge branch 'main' into other-branch 25EOF 26 27 # Initial commit and feature branch to merge main into it. 28 git commit --allow-empty -m "Initial empty commit" && 29 git checkout -b other-branch && 30 test_commit other-branch file1 1 31} 32 33# Setup repository, files & feature branch 34# This step must be run if You want to test 2,3 or 4 35# Order of 2,3,4 is not important, but 1 must be run before 36# For example `-r 1,4` or `-r 1,4,2 -v` etc 37# But not `-r 2` or `-r 4,3,2,1` 38test_expect_success 'setup' ' 39 test_setup 40' 41 42# Test with --signoff flag 43test_expect_success 'git merge --signoff adds a sign-off line' ' 44 git checkout main && 45 test_commit main-branch-2 file2 2 && 46 git checkout other-branch && 47 git merge main --signoff --no-edit && 48 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && 49 test_cmp expected-signed actual 50' 51 52# Test without --signoff flag 53test_expect_success 'git merge does not add a sign-off line' ' 54 git checkout main && 55 test_commit main-branch-3 file3 3 && 56 git checkout other-branch && 57 git merge main --no-edit && 58 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && 59 test_cmp expected-unsigned actual 60' 61 62# Test for --no-signoff flag 63test_expect_success 'git merge --no-signoff flag cancels --signoff flag' ' 64 git checkout main && 65 test_commit main-branch-4 file4 4 && 66 git checkout other-branch && 67 git merge main --no-edit --signoff --no-signoff && 68 git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && 69 test_cmp expected-unsigned actual 70' 71 72test_done