Imported Upstream version 2.18.2
[platform/upstream/git.git] / t / t5521-pull-options.sh
index 18372ca..c19d8db 100755 (executable)
@@ -144,4 +144,70 @@ test_expect_success 'git pull --all --dry-run' '
        )
 '
 
+test_expect_success 'git pull --allow-unrelated-histories' '
+       test_when_finished "rm -fr src dst" &&
+       git init src &&
+       (
+               cd src &&
+               test_commit one &&
+               test_commit two
+       ) &&
+       git clone src dst &&
+       (
+               cd src &&
+               git checkout --orphan side HEAD^ &&
+               test_commit three
+       ) &&
+       (
+               cd dst &&
+               test_must_fail git pull ../src side &&
+               git pull --allow-unrelated-histories ../src side
+       )
+'
+
+test_expect_success 'git pull does not add a sign-off line' '
+       test_when_finished "rm -fr src dst actual" &&
+       git init src &&
+       test_commit -C src one &&
+       git clone src dst &&
+       test_commit -C src two &&
+       git -C dst pull --no-ff &&
+       git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'git pull --no-signoff does not add sign-off line' '
+       test_when_finished "rm -fr src dst actual" &&
+       git init src &&
+       test_commit -C src one &&
+       git clone src dst &&
+       test_commit -C src two &&
+       git -C dst pull --no-signoff --no-ff &&
+       git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
+       test_must_be_empty actual
+'
+
+test_expect_success 'git pull --signoff add a sign-off line' '
+       test_when_finished "rm -fr src dst expected actual" &&
+       echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
+       git init src &&
+       test_commit -C src one &&
+       git clone src dst &&
+       test_commit -C src two &&
+       git -C dst pull --signoff --no-ff &&
+       git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
+       test_cmp expected actual
+'
+
+test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
+       test_when_finished "rm -fr src dst actual" &&
+       git init src &&
+       test_commit -C src one &&
+       git clone src dst &&
+       test_commit -C src two &&
+       git -C dst pull --signoff --no-signoff --no-ff &&
+       git -C dst show -s --pretty="format:%(trailers)" HEAD >actual &&
+       test_must_be_empty actual
+'
+
 test_done