summaryrefslogtreecommitdiff
path: root/src/handlers/diff_header_diff.rs
AgeCommit message (Collapse)Author
2025-08-01Fix diff output when a diff ends with a mode changeThomas Otto
Output can be generated directly via Painter::write, or Painter::output_buffer. The latter must be emit()'ed before the former method can be used again, otherwise the order is incorrect. Tests added. Fixes #1504
2024-11-29clippy 1.83: apply explicit lifetimes elisions suggestionsThomas Otto
2024-05-04clippy (#1686)Dan Davison
2024-03-02Fix headers of modified binary files, closes #1621 (#1629)Paul
2022-03-30Add support for irreversible-deleteWilliam Escande
Fix #128 Add support for `git diff -D` (aka irreversible delete) The patch is adding a title for removed file, even when there is no file content in the diff output Without the patch, there was no output related to the file at all
2022-01-05Handle a mode change on a renamed file. (#875)Wayne Davison
* Handle a mode change on a renamed file. I changed the diff parsing to cache the mode info from the old/new mode lines until the parsing bumps into the start of the actual related diff, finds the diff line for an unrelated diff, or runs out of input. This allows the mode info to be output in conjunction with a file event instead of as a separate heading (that used to have an empty name when the mode change was for a rename). The mode info is passed down into the draw routines as a separate "addendum" string that the draw code can use as it likes. Currently that means that it appends the addendum string to the non-raw string in parens. I imagine that future draw routines could decide to put it in a separate box or some other per-routine method. There is currently a single function in src/handlers/draw.rs that joins the strings in the same way for everyone. A couple examples of how the new code looks: Δ foo.rs (mode +x) ─────────────────────────────────────────────────── renamed: old-longer-name → shorter-name (mode +x) ─────────────────────────────────────────────────── Would it look better on its own line? Δ foo.rs • mode +x ─────────────────────────────────────────────────── renamed: old-longer-name → shorter-name • mode +x ─────────────────────────────────────────────────── Would it look better appended after a "•" character? Δ foo.rs • mode +x ─────────────────────────────────────────────────── renamed: old-longer-name → shorter-name • mode +x ─────────────────────────────────────────────────── Should it be a user option? If so, we can do that later.
2021-12-05Add InMergeConflict to combined diff enum variantDan Davison
This allows keep-plus-minus-markers=false to be honored inside merge conflicts but not honored for combined diff regions outside merge conflicts.
2021-12-05Display merge conflictsDan Davison
2021-12-05Handle combined diff formatDan Davison
With this commit combined diff format (https://git-scm.com/docs/git-diff#_combined_diff_format) is handled appropriately. However, there is no special handling of merge conflict markers. Fixes #189, #736
2021-12-04Fix weird but correct line handlingDan Davison
This handler function was returning `false`, thus signaling that it had not handled the line, when it was not the responsibility of any other handler to handle the line. It was doing this to rely on the fall-through handlers determining whether to emit the line or skip it. But this risks another handler handling it and is a violation of the contract. It is much more appropriate to make the determination in the handler itself, emit it if appropriate, and signal that it has been handled.
2021-11-29Rename: FileMeta => DiffHeaderDan Davison