Skip to content

Commit 406acef

Browse files
committed
Allow empty paths to be passed to Stack in debug mode
It can handle it, so let's let it be a no-op.
1 parent 6f4bbc3 commit 406acef

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

gix-fs/src/stack.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl Stack {
6363
relative.is_relative(),
6464
"only index paths are handled correctly here, must be relative"
6565
);
66-
debug_assert!(!relative.to_string_lossy().is_empty(), "empty paths are not allowed");
6766

6867
if self.valid_components == 0 {
6968
delegate.push_directory(self)?;

gix-fs/tests/stack/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,16 @@ fn delegate_calls_are_consistent() -> crate::Result {
141141
"the stack is state so keeps thinking it's a directory which is consistent. Git does it differently though."
142142
);
143143

144+
s.make_relative_path_current("".as_ref(), &mut r)?;
145+
assert_eq!(
146+
r,
147+
Record {
148+
push_dir: 9,
149+
dirs: vec![".".into()],
150+
push: 14,
151+
},
152+
"empty-paths reset the tree effectively"
153+
);
154+
144155
Ok(())
145156
}

0 commit comments

Comments
 (0)