Merge branch 'rs/grep-h-c'
[gitweb.git] / t / t5801-remote-helpers.sh
index 0a83db8875cc221906ce292dd6247a0323ac6348..c33cc25805d2a913725355a183118a0dd5547800 100755 (executable)
@@ -6,6 +6,7 @@
 test_description='Test remote-helper import and export commands'
 
 . ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-gpg.sh
 
 compare_refs() {
        git --git-dir="$1/.git" rev-parse --verify $2 >expect &&
@@ -93,6 +94,19 @@ test_expect_failure 'push new branch with old:new refspec' '
        compare_refs local HEAD server refs/heads/new-refspec
 '
 
+test_expect_success 'forced push' '
+       (cd local &&
+       git checkout -b force-test &&
+       echo content >> file &&
+       git commit -a -m eight &&
+       git push origin force-test &&
+       echo content >> file &&
+       git commit -a --amend -m eight-modified &&
+       git push --force origin force-test
+       ) &&
+       compare_refs local refs/heads/force-test server refs/heads/force-test
+'
+
 test_expect_success 'cloning without refspec' '
        GIT_REMOTE_TESTGIT_REFSPEC="" \
        git clone "testgit::${PWD}/server" local2 2>error &&
@@ -150,18 +164,62 @@ test_expect_success 'push ref with existing object' '
        compare_refs local dup server dup
 '
 
+test_expect_success GPG 'push signed tag' '
+       (cd local &&
+       git checkout master &&
+       git tag -s -m signed-tag signed-tag &&
+       git push origin signed-tag
+       ) &&
+       compare_refs local signed-tag^{} server signed-tag^{} &&
+       test_must_fail compare_refs local signed-tag server signed-tag
+'
+
+test_expect_success GPG 'push signed tag with signed-tags capability' '
+       (cd local &&
+       git checkout master &&
+       git tag -s -m signed-tag signed-tag-2 &&
+       GIT_REMOTE_TESTGIT_SIGNED_TAGS=1 git push origin signed-tag-2
+       ) &&
+       compare_refs local signed-tag-2 server signed-tag-2
+'
+
 test_expect_success 'push update refs' '
        (cd local &&
        git checkout -b update master &&
        echo update >>file &&
        git commit -a -m update &&
-       git push origin update
+       git push origin update &&
        git rev-parse --verify remotes/origin/update >expect &&
        git rev-parse --verify testgit/origin/heads/update >actual &&
        test_cmp expect actual
        )
 '
 
+test_expect_success 'push update refs disabled by no-private-update' '
+       (cd local &&
+       echo more-update >>file &&
+       git commit -a -m more-update &&
+       git rev-parse --verify testgit/origin/heads/update >expect &&
+       GIT_REMOTE_TESTGIT_NO_PRIVATE_UPDATE=t git push origin update &&
+       git rev-parse --verify testgit/origin/heads/update >actual &&
+       test_cmp expect actual
+       )
+'
+
+test_expect_success 'push update refs failure' '
+       (cd local &&
+       git checkout update &&
+       echo "update fail" >>file &&
+       git commit -a -m "update fail" &&
+       git rev-parse --verify testgit/origin/heads/update >expect &&
+       GIT_REMOTE_TESTGIT_PUSH_ERROR="non-fast forward" &&
+       export GIT_REMOTE_TESTGIT_PUSH_ERROR &&
+       test_expect_code 1 git push origin update &&
+       git rev-parse --verify testgit/origin/heads/update >actual &&
+       test_cmp expect actual
+       )
+'
+
 test_expect_success 'proper failure checks for fetching' '
        (GIT_REMOTE_TESTGIT_FAILURE=1 &&
        export GIT_REMOTE_TESTGIT_FAILURE &&
@@ -176,9 +234,7 @@ test_expect_success 'proper failure checks for pushing' '
        (GIT_REMOTE_TESTGIT_FAILURE=1 &&
        export GIT_REMOTE_TESTGIT_FAILURE &&
        cd local &&
-       test_must_fail git push --all 2> error &&
-       cat error &&
-       grep -q "Reading from helper .git-remote-testgit. failed" error
+       test_must_fail git push --all
        )
 '