git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] add a diff-files command (revised and cleaned up)

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 28, 2005, 17:08 UTC
Message-ID
<Pine.LNX.4.58.0504280950340.18901@ppc970.osdl.org>
In-Reply-To
<Pine.LNX.4.62.0504272239420.14033@localhost.localdomain>
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
Previous: Nicolas PitreNext: Nicolas Pitre
Message 2 of 4 in “add a diff-files command (revised and cleaned up)”
  1. add a diff-files command (revised and cleaned up)Nicolas Pitre, Apr 28, 2005
  2. Linus TorvaldsApr 28, 2005
  3. Nicolas PitreApr 28, 2005
  4. Junio C HamanoApr 28, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.