branch: improve documentation and naming of create_branch() parameters
[gitweb.git] / t / t1020-subdirectory.sh
index 2edb4f2de5cc32d0f8847790d06a8de0c98d99c3..df3183ea1ab36a46b914333e834093bd50847265 100755 (executable)
@@ -141,13 +141,13 @@ test_expect_success 'GIT_PREFIX for !alias' '
 test_expect_success 'GIT_PREFIX for built-ins' '
        # Use GIT_EXTERNAL_DIFF to test that the "diff" built-in
        # receives the GIT_PREFIX variable.
-       printf "dir/" >expect &&
-       printf "#!/bin/sh\n" >diff &&
-       printf "printf \"\$GIT_PREFIX\"" >>diff &&
-       chmod +x diff &&
+       echo "dir/" >expect &&
+       write_script diff <<-\EOF &&
+       printf "%s\n" "$GIT_PREFIX"
+       EOF
        (
                cd dir &&
-               printf "change" >two &&
+               echo "change" >two &&
                GIT_EXTERNAL_DIFF=./diff git diff >../actual
                git checkout -- two
        ) &&
@@ -162,16 +162,20 @@ test_expect_success 'no file/rev ambiguity check inside .git' '
        )
 '
 
-test_expect_success 'no file/rev ambiguity check inside a bare repo' '
+test_expect_success 'no file/rev ambiguity check inside a bare repo (explicit GIT_DIR)' '
+       test_when_finished "rm -fr foo.git" &&
        git clone -s --bare .git foo.git &&
        (
                cd foo.git &&
+               # older Git needed help by exporting GIT_DIR=.
+               # to realize that it is inside a bare repository.
+               # We keep this test around for regression testing.
                GIT_DIR=. git show -s HEAD
        )
 '
 
-# This still does not work as it should...
-: test_expect_success 'no file/rev ambiguity check inside a bare repo' '
+test_expect_success 'no file/rev ambiguity check inside a bare repo' '
+       test_when_finished "rm -fr foo.git" &&
        git clone -s --bare .git foo.git &&
        (
                cd foo.git &&
@@ -180,7 +184,6 @@ test_expect_success 'no file/rev ambiguity check inside a bare repo' '
 '
 
 test_expect_success SYMLINKS 'detection should not be fooled by a symlink' '
-       rm -fr foo.git &&
        git clone -s .git another &&
        ln -s another yetanother &&
        (