Skip to content

Commit 33e808c

Browse files
authored
Merge pull request #2285 from cruessler/account-for-no-newline-at-end-of-file
Account for "\ No newline at end of file" in baseline diff parser
2 parents 9f49dd3 + 3a607a7 commit 33e808c

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

gix-diff/src/blob/platform.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ pub mod prepare_diff {
243243
/// Use it in [`Platform::prepare_diff_command`](super::Platform::prepare_diff_command()) to easily prepare a compatible invocation.
244244
command: &'a BStr,
245245
},
246-
/// One of the involved resources, [`old`](Outcome::old) or [`new`](Outcome::new), were binary and thus no diff
247-
/// cannot be performed.
246+
/// One of the involved resources, [`old`](Outcome::old) or [`new`](Outcome::new), was binary and thus no diff
247+
/// can be performed.
248248
SourceOrDestinationIsBinary,
249249
}
250250

gix-diff/tests/diff/blob/slider.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,13 @@ mod baseline {
213213
hunk_lines.extend_from_slice(line);
214214
hunk_lines.push(b'\n');
215215
}
216-
_ => unreachable!("BUG: expecting unified diff format"),
216+
b'\\' => {
217+
assert_eq!(line, "\\ No newline at end of file".as_bytes());
218+
}
219+
_ => unreachable!(
220+
"BUG: expecting unified diff format, found line: `{}`",
221+
line.to_str_lossy()
222+
),
217223
}
218224

219225
match self.lines.peek() {

tests/it/src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub enum Subcommands {
159159
/// platforms (at least Windows) do not have such permissions, but Git still represents them.
160160
///
161161
/// This currently only checks files name with an `.sh` suffix, and only operates on the
162-
/// current repository. Its main use is checking that fixture scripts are have correct modes.
162+
/// current repository. Its main use is checking that fixture scripts have correct modes.
163163
#[clap(visible_alias = "cm")]
164164
CheckMode {},
165165
/// Print environment variables as `NAME=value` lines.

0 commit comments

Comments
 (0)