Comments (9)
@blackdrago diff2html shows new files like this https://diff2html.xyz/demo?diff=https://github.com/rtfpessoa/diff2html-cli/commit/184abc28ee5b47b51169e8981a5225aeff341ec2#d2h-109595
Can you post the unified diff output here?
from diff2html-cli.
This unified diff output is from the following command:
diff --exclude=.svn -ru /home/vagrant/projects/svn/project-name /var/www/html/sandbox/vendor/vendor-name/project-name > diffOut.txt
I've attached diffOut.txt and a screenshot of the diff2html file, which shows 6 changed files (but no new files). Let me know if you need anything else.
[removed attachments]
from diff2html-cli.
diff2html only finds new files because git diff
provides extra information. Since you are using diff it cannot know if the file is new in the same way.
Maybe it can be done by checking if all the lines are new or deleted.
Could be a nice improvement to do. If you are interested a PR would be nice.
We could perform the check here https://github.com/rtfpessoa/diff2html/blob/master/src/diff-parser.js#L64
from diff2html-cli.
Definitely interested. Could you give me a file with sample output from a git diff with modified as well as new / removed files? That would show me what diff2html expects and give me a comparison to start with.
from diff2html-cli.
A new file git diff would look like this:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..2c12dfc
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,62 @@
+## How to contribute to diff2html-cli
+
+### Main rules
+
+* Before you open a ticket or send a pull request, [search](https://github.com/rtfpessoa/diff2html-cli/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one.
But in your case I think the best way would be just to check if all the lines in the file are new or remove when adding the file to the list after parsing it.
from diff2html-cli.
I found that no code update is necessary. I discovered that diff2html will report new files, you need only pass --new-file to diff:
I was running:
diff --exclude=.svn -ru /localpath /svpath | diff2html -F /var/www/html/diff-out.html -i stdin
"New File" flag:
diff --exclude=.svn --new-file -ru /localpath /svpath | diff2html -F /var/www/html/diff-out.html -i stdin
New and deleted files now appear in the diff2html! :) No code changes necessary. Sorry for raising a non-issue...
from diff2html-cli.
Ok. Nice no problem.
Still I might pick this when I get some time since it is nice if I can detect this files even without the extra info.
from diff2html-cli.
Just a small note, checking if all the lines are added or deleted might be a legit case of a non-new/deleted file. Say you decide to delete all the lines in a file to start new (or because is part of some process). Same for additions. Is unlikely, but people use git in very different ways.
Finding the right command I think is the best approach. Is not diff2html responsibility to try to figure out what you are trying to do in my opinion.
from diff2html-cli.
@pbu88 good point.
from diff2html-cli.
Related Issues (20)
- ignore.map is not a function HOT 2
- -M flag exists? HOT 1
- Dependency update? HOT 3
- Unescaped broken HTML in the output HOT 6
- Selecting an output file is not overriding the preview open HOT 1
- ENOBUFS error when comparing large commits HOT 3
- Cannot make to work API from imported library HOT 9
- "--ig" argument leads to git diff error HOT 7
- diff2html is missing file content toggle HOT 1
- --title option not working HOT 2
- miss-align when show some diff file HOT 4
- Still running out of heap memory while allowing node 60GB HOT 4
- '--renderNothingWhenEmpty' didn't work when using 'stdin' as input HOT 1
- Impossible to create a diff from file – 5.2.6
- Can't run diff2html-cli on linux docker container HOT 1
- Cannot see diff on specials characters (eg ^M) HOT 1
- Not able to run diff2html-cli on both windows and wsl HOT 4
- feature: add colorScheme arg
- Feature request: line anchor
- Return code should be non-zero on error HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diff2html-cli.