git p4 test: keep P4CLIENT changes inside subshells
[gitweb.git] / t / t9806-git-p4-options.sh
index a51f1221edafa049e0e723378c667b70fd523d54..8d914a5766f2ebe3a0a3a2095a6ddf24fe1025c5 100755 (executable)
@@ -88,14 +88,14 @@ test_expect_success 'sync when two branches but no master should noop' '
        )
 '
 
-test_expect_failure 'sync --branch updates specified branch' '
+test_expect_success 'sync --branch updates specific branch, no detection' '
        test_when_finished cleanup_git &&
        (
                cd "$git" &&
                git init &&
-               git p4 sync --branch=refs/remotes/p4/b1 //depot@2 &&
-               git p4 sync --branch=refs/remotes/p4/b2 //depot@2 &&
-               git p4 sync --branch=refs/remotes/p4/b2 &&
+               git p4 sync --branch=b1 //depot@2 &&
+               git p4 sync --branch=b2 //depot@2 &&
+               git p4 sync --branch=b2 &&
                git show -s --format=%s refs/remotes/p4/b1 >show &&
                grep "Initial import" show &&
                git show -s --format=%s refs/remotes/p4/b2 >show &&
@@ -226,9 +226,11 @@ test_expect_success 'clone --use-client-spec' '
                View: //depot/sub/... //client2/bus/...
                EOF
        ) &&
-       P4CLIENT=client2 &&
        test_when_finished cleanup_git &&
-       git p4 clone --dest="$git" --use-client-spec //depot/... &&
+       (
+               P4CLIENT=client2 &&
+               git p4 clone --dest="$git" --use-client-spec //depot/...
+       ) &&
        (
                cd "$git" &&
                test_path_is_file bus/dir/f4 &&
@@ -241,6 +243,7 @@ test_expect_success 'clone --use-client-spec' '
                cd "$git" &&
                git init &&
                git config git-p4.useClientSpec true &&
+               P4CLIENT=client2 &&
                git p4 sync //depot/... &&
                git checkout -b master p4/master &&
                test_path_is_file bus/dir/f4 &&