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

feat: add --new-file arg to diff command #19

Merged
merged 1 commit into from
Sep 10, 2021

Conversation

deroke
Copy link
Contributor

@deroke deroke commented Sep 9, 2021

When i compare two versions of a package new/deleted files aren't diffed correctly (in my opinion).

Example:

diff --recursive --unified --exclude test --exclude Makefile <package@1> <package@2>

# new files
Only in <package@1>: some-file-1.txt

# deleted files
Only in <package@2>: some-file-2.txt

After this PR:

diff --recursive --unified --new-file --exclude test --exclude Makefile <package@1> <package@2>

# new files
--- <package@1>/some-file-1.txt	1970-01-01 01:00:00.000000000 +0100
+++ <package@2>/some-file-1.txt	2021-09-09 11:11:11.000000000 +0200
@@ -0,0 +1,9 @@
+this is a test

# deleted files
--- <package@1>/some-file-2.txt	1970-01-01 01:00:00.000000000 +0100
+++ <package@2>/some-file-2.txt	2021-09-09 11:11:11.000000000 +0200
@@ -1,9 +0,0 @@
-this is another test

https://man7.org/linux/man-pages/man1/diff.1.html

@juliangruber juliangruber merged commit 673cf22 into juliangruber:master Sep 10, 2021
@juliangruber
Copy link
Owner

Perfect, makes a lot of sense, that's why I love open source. Thank you so much!

https://github.com/juliangruber/npm-diff/releases/tag/v2.0.1

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