Skip to content
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

Arbitrary diff improvements #293

Conversation

RyanKoppenhaver-NCC
Copy link

I found that the existing work on #220 didn't really work well for me with with the output of plain diff(1), particularly recursive diffs. These changes fix the matching on the filename line (which didn't allow for the -u flag), and add colorization to hunk markers and "Only in ..." lines.

@scottchiefbaker
Copy link
Contributor

👍 for passing all the existing tests with this
👍 for adding new tests

This is looking merge-worthy assuming we can get some clarification in comments of what certain things do. I'm pretty impressed!

@paulirish
Copy link
Member

I was just diffing a diff yesterday so I'm super jazzed about this. Nice stuff, @RyanKoppenhaver-NCC !

@scottchiefbaker
Copy link
Contributor

@paulirish what was your use case? Something like:

diff -u file1.txt file2.txt

@scottchiefbaker
Copy link
Contributor

Ping... @paulirish and @RyanKoppenhaver-NCC looking for feedback.

@RyanKoppenhaver-NCC
Copy link
Author

@scottchiefbaker I'm happy to elaborate, but I'm not sure if you're asking for additional code comments, or comments on this PR. Anything specific questions?

@scottchiefbaker
Copy link
Contributor

@RyanKoppenhaver-NCC I put some comments/questions on specific lines of code in this PR. Can you respond to those?

@paulirish
Copy link
Member

@scottchiefbaker my usecase is typically this:

git diff --no-index fileA fileB

but sometimes i'm falling back to bare diff for portability.

diff -u fileA fileB

@paulirish
Copy link
Member

I put some comments/questions on specific lines of code in this PR. Can you respond to those?

I'm not seeing those comments over here, FYI.

@scottchiefbaker
Copy link
Contributor

No? Here is my view:

35479ef2-7986-4567-a2c9-0a48e8bfc4c1

@RyanKoppenhaver-NCC
Copy link
Author

Yeah, I'm not seeing inline comments either.

@RyanKoppenhaver-NCC
Copy link
Author

Ah, it says here that they're not visible until you submit the review: https://help.github.com/articles/reviewing-proposed-changes-in-a-pull-request/

Copy link
Contributor

@scottchiefbaker scottchiefbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of things to check

diff-so-fancy Outdated
} else {
$last_file_seen = $5;
$diff_args =~ s/\e.*$//;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these two lines do? Can you at least add a comment on what these regexp replaces accomplish. Maybe a before and after so we know what the strings should look like?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments.

diff-so-fancy Outdated
# Git looks like: diff --git a/diff-so-fancy b/diff-so-fancy
} elsif ($diff_args =~ /^(?:--git|--cc) (.+?)(\s|\e|$)/) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?: is a non-capturing parenthesis right? I don't use this syntax very often so this might confuse me in the future. Is there a reason to do this, and not just have $last_file_seen = $2 ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I used it out of a vague sense that it's more efficient, but even if it is, I'm sure it's trivial, so I'll switch it.

@scottchiefbaker
Copy link
Contributor

@RyanKoppenhaver-NCC good catch. I just submitted, do you see them now?

Addresses review comments.
@veggiemonk
Copy link

veggiemonk commented Oct 8, 2018

@scottchiefbaker can this be merged and released please 😄 ?
Happy to help

@scottchiefbaker
Copy link
Contributor

@veggiemonk thanks for reminding me this was still open. My feedback still stands for @RyanKoppenhaver-NCC . If he can address the changes I suggested we can certainly revisit this.

Also, a LOT of work has gone in to handling standalone diffs in the next branch so this may not be quite as needed as it once was.

@scottchiefbaker
Copy link
Contributor

Oh I see @RyanKoppenhaver-NCC did reply but it got buried in the GitHub UI. Can you provide a before and after screenshot of exactly what code this addresses. I don't use vanilla diff much.

Also, is this code still relevant, or does it need to be updated (original submission was March 22nd) to work with next.

@veggiemonk
Copy link

@scottchiefbaker I understand it might be quite outdated but a new release would be nice. What do you think ? The latest release is from 2017

@scottchiefbaker
Copy link
Contributor

I'm definitely overdue for a release, I just want to make sure this code is still in good shape (no bitrot) before we merge it.

@scottchiefbaker
Copy link
Contributor

Version 1.2.5 has been released and should address part of this issue. There is some bitrot here so I'm going to close this particular issue. I'm 100% open to accepting this in the future once it's reworked against version 1.2.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants