summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-06-02 15:06:04 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-02 15:06:05 +0900
commitf4fd99bf6e5c27265ee2a9ccb9c2495854f67acb (patch)
tree2fae59f74c523e7e58465b24aa343b4a90debc46 /t
parentMerge branch 'sb/t5531-update-desc' (diff)
parentclean: teach clean -d to preserve ignored paths (diff)
downloadtgif-f4fd99bf6e5c27265ee2a9ccb9c2495854f67acb.tar.xz
Merge branch 'sl/clean-d-ignored-fix'
"git clean -d" used to clean directories that has ignored files, even though the command should not lose ignored ones without "-x". "git status --ignored" did not list ignored and untracked files without "-uall". These have been corrected. * sl/clean-d-ignored-fix: clean: teach clean -d to preserve ignored paths dir: expose cmp_name() and check_contains() dir: hide untracked contents of untracked dirs dir: recurse into untracked dirs for ignored files t7061: status --ignored should search untracked dirs t7300: clean -d should skip dirs with ignored files
Diffstat (limited to 't')
-rwxr-xr-xt/t7061-wtstatus-ignore.sh1
-rwxr-xr-xt/t7300-clean.sh16
2 files changed, 17 insertions, 0 deletions
diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
index cdc0747bf0..fc6013ba3c 100755
--- a/t/t7061-wtstatus-ignore.sh
+++ b/t/t7061-wtstatus-ignore.sh
@@ -9,6 +9,7 @@ cat >expected <<\EOF
?? actual
?? expected
?? untracked/
+!! untracked/ignored
EOF
test_expect_success 'status untracked directory with --ignored' '
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index b89fd2a6ad..7b36954d63 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -653,4 +653,20 @@ test_expect_success 'git clean -d respects pathspecs (pathspec is prefix of dir)
test_path_is_dir foobar
'
+test_expect_success 'git clean -d skips untracked dirs containing ignored files' '
+ echo /foo/bar >.gitignore &&
+ echo ignoreme >>.gitignore &&
+ rm -rf foo &&
+ mkdir -p foo/a/aa/aaa foo/b/bb/bbb &&
+ touch foo/bar foo/baz foo/a/aa/ignoreme foo/b/ignoreme foo/b/bb/1 foo/b/bb/2 &&
+ git clean -df &&
+ test_path_is_dir foo &&
+ test_path_is_file foo/bar &&
+ test_path_is_missing foo/baz &&
+ test_path_is_file foo/a/aa/ignoreme &&
+ test_path_is_missing foo/a/aa/aaa &&
+ test_path_is_file foo/b/ignoreme &&
+ test_path_is_missing foo/b/bb
+'
+
test_done