Skip to content

Commit 03efe8c

Browse files
committed
version 0.2.11
1 parent 6c03be8 commit 03efe8c

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "codeowners"
3-
version = "0.2.10"
3+
version = "0.2.11"
44
edition = "2024"
55

66
[profile.release]

src/files.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ pub(crate) fn untracked_files(base_path: &Path) -> Result<Vec<PathBuf>, Error> {
2828
.output()
2929
.change_context(Error::Io)?;
3030

31-
if output.status.success() {
32-
let stdout = output.stdout;
33-
let mut results: Vec<PathBuf> = Vec::new();
34-
for rel in stdout.split(|b| *b == 0).filter(|s| !s.is_empty()) {
35-
let rel_str = std::str::from_utf8(rel).change_context(Error::Io)?;
36-
results.push(base_path.join(rel_str));
37-
}
38-
return Ok(results);
31+
if !output.status.success() {
32+
return Ok(Vec::new());
3933
}
40-
Ok(vec![])
34+
35+
let results: Vec<PathBuf> = output
36+
.stdout
37+
.split(|&b| b == b'\0')
38+
.filter(|chunk| !chunk.is_empty())
39+
.map(|rel| std::str::from_utf8(rel).change_context(Error::Io).map(|s| base_path.join(s)))
40+
.collect::<std::result::Result<_, _>>()?;
41+
42+
Ok(results)
4143
}
4244

4345
#[cfg(test)]

0 commit comments

Comments
 (0)