-
Notifications
You must be signed in to change notification settings - Fork 335
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
Support vanilla diff recursive flag #436
Conversation
I consider myself fairly well versed in regular expressions, but man what you wrote is beyond me :) I'd like the comment above the regexp adjusted so the |
Otherwise things look good. Clean diff and solid unit tests. |
Sorry for missing that part about the patterns positions. |
This looks good, and a lot clearer to me :) What string are we actually matching against in a recursive diff. Do you have an example? |
Basically the vanilla uses the -r or --recursive flag for recursive diff. For the longhand --recursive string we match it as is like in |
Since all we're trying to do is capture
That will ensure the |
Sorry I was not clear in the answer. My bad.
So the current proposal covers all 10 variants. regex101.com complex sample
will cover only the number 3 and number 9 variants. regex101.com readable sample I think there should be a trade-off between readability and adaptability. Since it is user managed more than the git diff which is somehow standardized as alias diffr='diff -br' #diff recursive ignoring whitespace changes or much more complex. Also forgetting to remember to use the flag -r separated made me re-run the diff a second time every time to fix it. So, if the choice is the readability one option to consider is to enforce/clarify in the docs to use -r (separated) or --recursive flags as first arguments. alias diffr='diff -r -b <extra_args>' #diff recursive ignoring whitespace changes or alias diffr='diff --recursive -b <extra_args>' #diff recursive ignoring whitespace changes Let me know about your choice so I will make change to the PR to suit if needed. |
Let me start with... dang you are thorough! I love it. I wish all of our contributions were as thorough and well designed as this. I personally don't use I'm leaning towards just going the KISS route and only supporting the simplest use case, because it will make the code a lot easier to maintain. This issue has not been a major sticking point for a lot of people, so I don't get the impression a lot of people use it. I might be wrong there though. |
Thank you very much. I just wanted to be as clear as possible. Actually, I thought you would have been bored reading such long comment 😅 You are right asking the main question "what problem are we trying to solve". However, I think it will be helpful to have a comment in the doc for stating the support for recursive with vanilla diff as below. With diffUse diff -u file_a file_b | diff-so-fancy It also supports the recursive mode of diff with diff -r -u file_a file_b | diff-so-fancy Adding the first argument will let people to even tweak their config if needed to accommodate. What do you think ? |
@brewsfab to hit on everything I was thinking. No need to over-complicate the code a simple feature. I think we should have support for two calling methods:
and update the documentation to reflect that the recursive flag needs to be immediately after the diff like you mentioned. I think that is a good compromise if simplicity and feature support. If you want to update this pull request to reflect that I will land it. |
Thanks. I have simplified the regex and added the comment as requested. |
Looks great... thanks for all the hard work and the revisions! |
It would be great if the instructions from the readme would also be added to the |
Pull requests welcome |
Thank you so much for the great project you brought to us.
Needed support for the recursive flag so I made this improvement thinking it could help more people.
It basically treats the vanilla diff with recursive flag as Mercurial.