diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-08 14:25:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 14:25:22 -0500 |
commit | 5d85efd595e13863a443fb53a8b2954e5c6c77cc (patch) | |
tree | 8ac548a6ac5df550f865387fb56b80a2f12896a6 /cli/util/fs.rs | |
parent | fee4943f760fae2c9386ceeda86c3f8fbfd8e6a0 (diff) |
fix(publish): ability to un-exclude when .gitignore ignores everything (#22805)
This is an unrealistic scenario, but it's still a good thing to fix and
have a test for because it probably fixes some other underlying issues
with how the gitignore was being resolved for the root directory.
From https://github.com/denoland/deno/pull/22720#issuecomment-1986134425
Diffstat (limited to 'cli/util/fs.rs')
-rw-r--r-- | cli/util/fs.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/util/fs.rs b/cli/util/fs.rs index 352e09999..e84f05d1e 100644 --- a/cli/util/fs.rs +++ b/cli/util/fs.rs @@ -373,8 +373,11 @@ impl<TFilter: Fn(WalkEntry) -> bool> FileCollector<TFilter> { let path = e.path().to_path_buf(); let maybe_gitignore = maybe_git_ignores.as_mut().and_then(|git_ignores| { - let dir_path = if is_dir { &path } else { path.parent()? }; - git_ignores.get_resolved_git_ignore(dir_path) + if is_dir { + git_ignores.get_resolved_git_ignore_for_dir(&path) + } else { + git_ignores.get_resolved_git_ignore_for_file(&path) + } }); if !is_pattern_matched( maybe_gitignore.as_deref(), |