Skip to content

Commit b5b50f8

Browse files
committed
fix: hanging Read implementation of pipeline::convert::ToGitOutcome.
This codepath was never tested and its function more subtle than one could have known. Also fix incorrect configuration handling which could lead to binary files with `text=auto` to be identified as text, which would then require conversion.
1 parent 7ba2fa1 commit b5b50f8

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Diff for: gix-filter/src/pipeline/convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ where
315315
match self {
316316
ToGitOutcome::Unchanged(r) => r.read(buf),
317317
ToGitOutcome::Process(r) => r.read(buf),
318-
ToGitOutcome::Buffer(mut r) => r.read(buf),
318+
ToGitOutcome::Buffer(r) => r.read(buf),
319319
}
320320
}
321321
}

Diff for: gix-filter/src/pipeline/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'driver> Configuration<'driver> {
170170
let attr_digest = digest;
171171
digest = match digest {
172172
None => Some(config.auto_crlf.into()),
173-
Some(AttributesDigest::TextAuto) => Some(config.to_eol().into()),
173+
Some(AttributesDigest::Text) => Some(config.to_eol().into()),
174174
_ => digest,
175175
};
176176

Diff for: gix-filter/tests/pipeline/convert_to_git.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn no_driver_but_filter_with_autocrlf() -> gix_testtools::Result {
1919
)
2020
})?;
2121

22-
let out = pipe.convert_to_git(
22+
let mut out = pipe.convert_to_git(
2323
"hi\r\n".as_bytes(),
2424
Path::new("any.txt"),
2525
&mut |_path, _attrs| {},
@@ -31,6 +31,9 @@ fn no_driver_but_filter_with_autocrlf() -> gix_testtools::Result {
3131
"hi\n",
3232
"the read is read into memory if there is no driver"
3333
);
34+
let mut buf = Vec::new();
35+
out.read_to_end(&mut buf)?;
36+
assert_eq!(buf.as_bstr(), "hi\n", "we can consume the output");
3437
Ok(())
3538
}
3639

0 commit comments

Comments
 (0)