Merge branch 'sb/t1020-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 May 2015 19:41:59 +0000 (12:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 May 2015 19:42:00 +0000 (12:42 -0700)
There was a commented-out (instead of being marked to expect
failure) test that documented a breakage that was fixed since the
test was written; turn it into a proper test.

* sb/t1020-cleanup:
subdirectory tests: code cleanup, uncomment test

1  2 
t/t1020-subdirectory.sh
diff --combined t/t1020-subdirectory.sh
index 2edb4f2de5cc32d0f8847790d06a8de0c98d99c3,d1e5bb3d802906b4b9cba2948948cff98d16ac95..8e22b03cdd132bd54f9db44d362c15d129415651
@@@ -20,27 -20,27 +20,27 @@@ test_expect_success setup 
  
  test_expect_success 'update-index and ls-files' '
        git update-index --add one &&
 -      case "`git ls-files`" in
 +      case "$(git ls-files)" in
        one) echo pass one ;;
        *) echo bad one; exit 1 ;;
        esac &&
        (
                cd dir &&
                git update-index --add two &&
 -              case "`git ls-files`" in
 +              case "$(git ls-files)" in
                two) echo pass two ;;
                *) echo bad two; exit 1 ;;
                esac
        ) &&
 -      case "`git ls-files`" in
 +      case "$(git ls-files)" in
        dir/two"$LF"one) echo pass both ;;
        *) echo bad; exit 1 ;;
        esac
  '
  
  test_expect_success 'cat-file' '
 -      two=`git ls-files -s dir/two` &&
 -      two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` &&
 +      two=$(git ls-files -s dir/two) &&
 +      two=$(expr "$two" : "[0-7]* \\([0-9a-f]*\\)") &&
        echo "$two" &&
        git cat-file -p "$two" >actual &&
        cmp dir/two actual &&
@@@ -55,18 -55,18 +55,18 @@@ rm -f actual dir/actua
  test_expect_success 'diff-files' '
        echo a >>one &&
        echo d >>dir/two &&
 -      case "`git diff-files --name-only`" in
 +      case "$(git diff-files --name-only)" in
        dir/two"$LF"one) echo pass top ;;
        *) echo bad top; exit 1 ;;
        esac &&
        # diff should not omit leading paths
        (
                cd dir &&
 -              case "`git diff-files --name-only`" in
 +              case "$(git diff-files --name-only)" in
                dir/two"$LF"one) echo pass subdir ;;
                *) echo bad subdir; exit 1 ;;
                esac &&
 -              case "`git diff-files --name-only .`" in
 +              case "$(git diff-files --name-only .)" in
                dir/two) echo pass subdir limited ;;
                *) echo bad subdir limited; exit 1 ;;
                esac
  '
  
  test_expect_success 'write-tree' '
 -      top=`git write-tree` &&
 +      top=$(git write-tree) &&
        echo $top &&
        (
                cd dir &&
 -              sub=`git write-tree` &&
 +              sub=$(git write-tree) &&
                echo $sub &&
                test "z$top" = "z$sub"
        )
@@@ -96,7 -96,7 +96,7 @@@ test_expect_success 'checkout-index' 
  
  test_expect_success 'read-tree' '
        rm -f one dir/two &&
 -      tree=`git write-tree` &&
 +      tree=$(git write-tree) &&
        read_tree_u_must_succeed --reset -u "$tree" &&
        cmp one original.one &&
        cmp dir/two original.two &&
@@@ -118,7 -118,7 +118,7 @@@ test_expect_success 'alias expansion' 
        )
  '
  
 -test_expect_success NOT_MINGW '!alias expansion' '
 +test_expect_success !MINGW '!alias expansion' '
        pwd >expect &&
        (
                git config alias.test-alias-directory !pwd &&
@@@ -162,16 -162,20 +162,20 @@@ test_expect_success 'no file/rev ambigu
        )
  '
  
- 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 &&
  '
  
  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 &&
        (