Re: git diff-files weirdness (bug?)
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- May 23, 2008, 16:50 UTC
- Message-ID
- <alpine.LFD.1.10.0805230942480.3081@woody.linux-foundation.org>
- In-Reply-To
- <alpine.LFD.1.10.0805230906110.3081@woody.linux-foundation.org>
On Fri, 23 May 2008, Linus Torvalds wrote:
> > And I think "setup_diff_no_index()" is broken exactly because it sees that > '--' and then totally ignores it and says "if I see two paths, we'll say > it's the non-index case".
Actually, I think it's broken not so much because it ignores '--', but because it's just way too eager to do the "non-git" case.
Basically, it is trying to act like a traditional "diff", but in doing so it disables the normal "git diff" semantics. Which is incorrect, when you actually _want_ the normal "git diff" behaviour.
So I would suggest that we make it *much* harder to trigger the "make it act like a traditional 'diff'" thing.
I would suggest that we *not* invoce the traditional 'diff' behaviour when:
- we're called as "git-diff-files". That's clearly a git thing. Don't try to make it act like an external non-git diff. Only do the special case for plain "git diff" itself.
- even for plain "git diff", make it much harder to trigger non-git behaviour. Don't do it if the files don't exist. Don't do it if there is '--' there.
In fact, maybe we should remove that thing entirely, or *require* a flag to enable it (at least if we're in a git directory). It's a cute hack, but when the cute hack actually makes it impossible to do certain real git operations, it's a cute hack that is detrimental.
Linus