-
Notifications
You must be signed in to change notification settings - Fork 311
Allow to omit large common parts in diff output #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@databus23 I've updated the branch to the new CLI interace. |
|
This one would be great to have, even without |
|
@mumoshu I've added the |
By default disabled, can be enabled and configured with `--context NUM`.
|
@mumoshu when you have a moment, would you be able to review this? |
|
@mumoshu let me know if something should be changed! :) |
mumoshu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@njam Thanks for your effort and the reminder! LGTM.
|
Cool, thanks! |
|
Should I add a Travis config? Or you will do it? |
By default disabled, can be enabled and configured with

--context NUM.Wdyt?
This is my first time writing Go code, please let me know if my naming is off, something should be refactored or just be done differently!
The code iterates over all diff records and keep track of how many lines are between the closest change (addition or removal) before the current line. Then it iterates again through all diff records but backwards and adjusts the distance if the closest change after the current line is closer.
When printing the diff we can then simply omit records that have a distance larger than the desired context.
I have an alternative implementation which first creates chunks and then iterates over chunks of diffs to print, if you prefer it: diff-with-chunks.go.