Skip to content

Commit

Permalink
Warn if patch fails to apply and windows new lines are involved
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Srb committed Feb 15, 2019
1 parent b8eb1ce commit e3f2190
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ only the `push` command. The goal is to be very fast.
* only the `push` command
* only patches in unified format
* date in patch files is ignored
* endlines must be the same in patch and patched file (e.g. both "\n" or both "\r\n")
* endlines must be the same in patch and patched file (e.g. both "\n" or both "\r\n") (always `--binary` mode)
* ... probably more that I don't know about

## Screenshot
Expand Down
5 changes: 4 additions & 1 deletion src/rapidquilt/apply/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ pub fn print_difference_to_closest_match<W: Write>(

if !line_str.ends_with('\n') {
writeln!(writer)?;
write!(writer, "{} \\ No new line!", prefix)?;
writeln!(writer, "{} {}{}", prefix, " ".repeat(line_str.len()), "^ no new line".bright_red())?;
}
if !line_str.ends_with("\r\n") {
writeln!(writer, "{} {}{}", prefix, " ".repeat(line_str.len()), "^ windows new line".bright_red())?;
}

Ok(())
Expand Down

0 comments on commit e3f2190

Please sign in to comment.