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

added --new-file option for GNU diff compatibility #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

deadPix3l
Copy link

Adds a new option to show file contents when one target does not exist.
If --new-file is passed and either a or b does not exist, it will diff the one that does exist against /dev/null

The effect of this is that the output will contain the full contents of the file, either every line showing as added or removed.
This provides helpful context beyond the default:

Only in /home/user/project/tests/.../: file1
Only in /home/user/project/tests/.../: file2
Only in /home/user/project/tests/.../: file3
...

You may ask "Okay the files are missing or added, thats maybe problematic? it all depends on what those files contain, however it doesnt show me that, so now I have to go and look at those files manually?" which is tedious and splits your outputs

NOTE: GNU diff also assigns the -N shorthand to --new-file but that cannot be the case here because it's already in use.

@jeffkaufman
Copy link
Owner

Thanks! Change makes sense and code looks good! Could you add a test?

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.

2 participants