From: Linus Torvalds Date: Thu, 28 Apr 2005 17:08:07 GMT Subject: Re: [PATCH] add a diff-files command (revised and cleaned up) Message-ID: In-Reply-To: On Wed, 27 Apr 2005, Nicolas Pitre wrote: > > In the same spirit as diff-tree and diff-cache, here is a diff-files > command that processes differences between the index cache and the > working directory content. I really think the current "show-diff" does that very well, and what you're doing is really different. I think this thing is really a replacement for "show-files", which is a piece of crap (hey, I wrote it, but I don't have to be proud of it), and which really was meant to be more of what your diff-files is. The thing is, I really don't want the "core" diff-xxx programs to worry about exclude patters, and current directory contents. They do one thing, and one thing only: compare the files they were explicitly told to compare. HOWEVER, there clearly is a separate problem, which is what "show-files" currently does very badly (and not at all in some cases), which is the "ok, what about the _other_ files?" And once you start talking about files that are _not_ mentioned in the index, now you really do have something totally different, and now it does need to be able to have exclude patterns to know to avoid object files and other crud that we know we're not interested in). But for the crud we don't know about, we're not really interested in the diff against something we _do_ know about. So I think that the whole "--others" and "--all" thing is wrong (yeah, yeah, it was me that started it with show-files), and that this thing should always _only_ look at files that aren't mentioned in the index file (ie "others" is always enabled, and "all" is pointless). Because those are special files: they are files we don't know what to do with (conversely, files that _are_ mentioned in the index but don't actually seem to show up are interesting for the exact same reason). That set of files is interesting for several reasons: - maybe we're about to check something in. We want to know whether maybe we've forgotten to "add" a file or "remove" a file. - is it a file we've lost track of, and if so, does it look anything like some _other_ file in the index. This happens if you do a "mv", and don't tell the SCM about it: git doesn't care (it looks like a remove and add), but it would be good to have a tool that warns about it and then it would be nice if it could actually say "files xxx and yyy seem to have gone away, but I see new files aaa and bbb, and it looks like bbb might be similar to yyy, and aaa looks a lot like the old xxx" This was all stuff that "show-files" was kind of supposed to work up to, but I just couldn't find it in myself to be interested enough. Linus