Merge branch 'en/clean-nested-with-ignored' into next

"git clean" fixes.

* en/clean-nested-with-ignored:
  dir: special case check for the possibility that pathspec is NULL
This commit is contained in:
Junio C Hamano
2019-10-03 10:45:21 +09:00
2 changed files with 25 additions and 3 deletions

8
dir.c
View File

@@ -1974,8 +1974,9 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
((state == path_untracked) &&
(get_dtype(cdir.de, istate, path.buf, path.len) == DT_DIR) &&
((dir->flags & DIR_SHOW_IGNORED_TOO) ||
do_match_pathspec(istate, pathspec, path.buf, path.len,
baselen, NULL, DO_MATCH_LEADING_PATHSPEC) == MATCHED_RECURSIVELY_LEADING_PATHSPEC))) {
(pathspec &&
do_match_pathspec(istate, pathspec, path.buf, path.len,
baselen, NULL, DO_MATCH_LEADING_PATHSPEC) == MATCHED_RECURSIVELY_LEADING_PATHSPEC)))) {
struct untracked_cache_dir *ud;
ud = lookup_untracked(dir->untracked, untracked,
path.buf + baselen,
@@ -1987,7 +1988,8 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
if (subdir_state > dir_state)
dir_state = subdir_state;
if (!match_pathspec(istate, pathspec, path.buf, path.len,
if (pathspec &&
!match_pathspec(istate, pathspec, path.buf, path.len,
0 /* prefix */, NULL,
0 /* do NOT special case dirs */))
state = path_none;

View File

@@ -131,4 +131,24 @@ $test_unicode 'merge (silent unicode normalization)' '
git merge topic
'
test_expect_success CASE_INSENSITIVE_FS 'checkout with no pathspec and a case insensitive fs' '
git init repo &&
(
cd repo &&
>Gitweb &&
git add Gitweb &&
git commit -m "add Gitweb" &&
git checkout --orphan todo &&
git reset --hard &&
mkdir -p gitweb/subdir &&
>gitweb/subdir/file &&
git add gitweb &&
git commit -m "add gitweb/subdir/file" &&
git checkout master
)
'
test_done