We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b52446c commit 892cb2aCopy full SHA for 892cb2a
cli/src/command/commons.rs
@@ -162,13 +162,13 @@ impl Ignore {
162
163
#[inline]
164
pub(crate) fn add_path(&mut self, path: impl AsRef<Path>) {
165
- let gitignore_path = path.as_ref().join(".gitignore");
+ let path = path.as_ref();
166
+ debug_assert!(path.is_dir());
167
+ let gitignore_path = path.join(".gitignore");
168
if gitignore_path.exists() {
169
let (ig, _) = ignore::gitignore::Gitignore::new(&gitignore_path);
170
// Key by the directory that owns this .gitignore
- if let Some(dir) = gitignore_path.parent() {
- self.by_dir.insert(dir.to_path_buf(), ig);
171
- }
+ self.by_dir.insert(path.to_path_buf(), ig);
172
}
173
174
0 commit comments