Merge branch 'maint'
[gitweb.git] / t / t3001-ls-files-others-exclude.sh
index efb7ebc91f2f46b38e0c02f4dd11e2224678baea..4e3735f0cb28d2b545f59a2464ea74bea4b626a1 100755 (executable)
@@ -103,7 +103,7 @@ test_expect_success \
      test_cmp expect output'
 
 test_expect_success 'restore gitignore' '
-       git checkout $allignores &&
+       git checkout --ignore-skip-worktree-bits $allignores &&
        rm .git/index
 '
 
@@ -214,6 +214,55 @@ test_expect_success 'subdirectory ignore (l1)' '
        test_cmp expect actual
 '
 
+test_expect_success 'show/hide empty ignored directory (setup)' '
+       rm top/l1/l2/l1 &&
+       rm top/l1/.gitignore
+'
+
+test_expect_success 'show empty ignored directory with --directory' '
+       (
+               cd top &&
+               git ls-files -o -i --exclude l1 --directory
+       ) >actual &&
+       echo l1/ >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'hide empty ignored directory with --no-empty-directory' '
+       (
+               cd top &&
+               git ls-files -o -i --exclude l1 --directory --no-empty-directory
+       ) >actual &&
+       >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'show/hide empty ignored sub-directory (setup)' '
+       > top/l1/tracked &&
+       (
+               cd top &&
+               git add -f l1/tracked
+       )
+'
+
+test_expect_success 'show empty ignored sub-directory with --directory' '
+       (
+               cd top &&
+               git ls-files -o -i --exclude l1 --directory
+       ) >actual &&
+       echo l1/l2/ >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'hide empty ignored sub-directory with --no-empty-directory' '
+       (
+               cd top &&
+               git ls-files -o -i --exclude l1 --directory --no-empty-directory
+       ) >actual &&
+       >expect &&
+       test_cmp expect actual
+'
+
 test_expect_success 'pattern matches prefix completely' '
        : >expect &&
        git ls-files -i -o --exclude "/three/a.3[abc]" >actual &&