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

Does not work upon comparing files that are not versioned (non git folders) #28

Closed
daformat opened this issue Dec 27, 2016 · 2 comments
Closed

Comments

@daformat
Copy link

So, git diff works pretty much without any trouble when you pass it local files that are from in non git versioned folders. Trying to get the same result with pretty-diff is a total fail.

Here is the git diff commands I'm using on a non git folder (working and giving the same result, which is expected)

git diff --word-diff file1.html file2.html
git diff --color-words --word-diff file1.html file2.html
git diff --no-index --color-words --word-diff file1.html file2.html
git diff --no-index --color-words --word-diff -- file1.html file2.html

All of these commands perfectly produces a colored word-diff, and works on non git initialized folders:
image

I get absolutely no result when trying the same thing with pretty-diff. Is there any configuration option I'm missing somewhere? I thought pretty-diff just "carried out" the args to git diff and expected to work out-of-the-box from what the README states "Simply use pretty-diff the same way you use git diff". Here is a screenshot:
image

I also tried inserting "diff" between pretty-diff and the rest of the args but it returns "error: not a git repository".

@scottgonzalez
Copy link
Owner

I didn't know that git diff worked outside of git repositories, but I guess that makes sense. The problem was that git diff exits with a code of 1 when you do that, even though it renders the diff. Since the exit code indicates an error, pretty-diff just prints out stderr from git diff, but in this case stderr is empty.

I've updated pretty-diff to handle this odd case and release v0.6.1.

@daformat
Copy link
Author

Yeah, I just got the notification and saw the 'hack' you had to pull of your hat :) Thanks for fixing this so quickly!

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

No branches or pull requests

2 participants