Skip to content

.gitignore problem #6

Closed
danillos opened this Issue Dec 12, 2012 · 3 comments

3 participants

@danillos

All files ignored by git is marked with +

@jisaacks
Owner

This is a problem, I am not currently sure the best way to handle this though, but it is something I am thinking about.

The problem is, the file is not in your repo, so as far as the diff is concerned, all the lines are new.

A possible solution would be to parse the .gitignore to see if the current file matches any of the regex's, but this could be expensive especially for long .gitignore files.

@genezys
genezys commented Dec 13, 2012

How about doing a git status first to check the status of the file ?

@jisaacks
Owner

@genezys That might work, I was also considering checking if lines-added == total-lines then don't process.

@jisaacks jisaacks added a commit that closed this issue Dec 15, 2012
@jisaacks Never show all lines as inserted - fixes #6
If all lines are marked as inserted in can only be 3 possible scenarios:

 - It is a brand new file not added to the repo yet (so they shouldn't be shown)
 - It is an ignored file from the .gitignore (so they shouldn't be shown)
 - It is a file that was commited with 0 lines so now all lines truly are insertions (not likely)
0fbfb3c
@jisaacks jisaacks closed this in 0fbfb3c Dec 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.