Re: [PATCH] Built-in diff driver shows Index: line.
From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:41:55
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