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

Re: [PATCH] Built-in diff driver shows Index: line.

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 28, 2005, 20:05 UTC
Message-ID
<Pine.LNX.4.58.0504281236090.18901@ppc970.osdl.org>
In-Reply-To
<7vy8b27lyf.fsf@assigned-by-dhcp.cox.net>
On Thu, 28 Apr 2005, Junio C Hamano wrote:
>
> As suggested by Linus as a workaround to unconfuse diffstat,
> this patch adds Index: line before the diff output the built-in
> driver produces.

Actually, I do dislike the Index: line, and think this is a pretty intrusive work-around for a problem with diffstat.

There are other work-arounds for diffstat. In particular, diffstat has various heuristics for finding the filename from the +++/--- files, and the main one is

	"*** %[^\t]\t%[^ ] %[^ ] %d %d:%d:%d %d"

(where "***" can be either +++ or ---). If if you match that one, diffstat will pick up the name (first match) on its own.

Oh, actually maybe the better pattern to use is the one that GNU diff itself ends up matching:

	"*** %[^\t ]%[\t ]%d%c%d%c%d %d:%d:%d"

where the "%c" has to be either '-' or '/' (ie it ends up matching as "numeric date" + "numeric time").

You can put the "mode" thing at the end, and diffstat won't care about it.
		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 5 in “Built-in diff driver shows Index: line.”
  1. Built-in diff driver shows Index: line.Junio C Hamano, Apr 28, 2005
  2. Linus TorvaldsApr 28, 2005
  3. Junio C HamanoApr 28, 2005
  4. Linus TorvaldsApr 28, 2005
  5. 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.