Merge branch 'rs/grep-h-c'
[gitweb.git] / t / t5801-remote-helpers.sh
index 16faa23154a7711ac7408d4a6df64e1623c28bcb..c33cc25805d2a913725355a183118a0dd5547800 100755 (executable)
@@ -8,11 +8,6 @@ test_description='Test remote-helper import and export commands'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-gpg.sh
 
-if ! type "${BASH-bash}" >/dev/null 2>&1; then
-       skip_all='skipping remote-testgit tests, bash not available'
-       test_done
-fi
-
 compare_refs() {
        git --git-dir="$1/.git" rev-parse --verify $2 >expect &&
        git --git-dir="$3/.git" rev-parse --verify $4 >actual &&
@@ -99,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 &&
@@ -187,6 +195,17 @@ test_expect_success 'push update refs' '
        )
 '
 
+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 &&
@@ -215,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
        )
 '