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

Re: git log --numstat disagrees with git apply --numstat

From
Jeff King <peff@peff.net>
Date
Dec 12, 2008, 02:08 UTC
Message-ID
<20081212020857.GB23128@sigill.intra.peff.net>
In-Reply-To
<20081212015254.GA23128@sigill.intra.peff.net>
On Thu, Dec 11, 2008 at 08:52:55PM -0500, Jeff King wrote:
Show 6 quoted lines
> It looks like it is just a place where two different valid diffs can be
> constructed:
> [...]
> which is probably just due to different xdi settings being used between
> the two codepaths. I haven't looked closely to see which different
> options we are feeding to xdiff.
Ah. Doing this gives me the 68/12 answer for "git log --numstat":
diff --git a/diff.c b/diff.c
index af822c1..5f314ce 100644
--- a/diff.c
+++ b/diff.c
@@ -1539,6 +1539,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
 
 		memset(&xpp, 0, sizeof(xpp));
 		memset(&xecfg, 0, sizeof(xecfg));
+		xecfg.ctxlen = o->context;
 		xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
 		xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
 			      &xpp, &xecfg, &ecb);

I guess it is slightly less efficient (since we just throw away the
context lines anyway), but it is nice to count the exact same patch
that "git log -p" would produce.

-Peff
Previous: Jeff KingNext: Jeff King
Message 3 of 6 in “git log --numstat disagrees with git apply --numstat”
  1. Shawn O. PearceDec 11, 2008
  2. Jeff KingDec 12, 2008
  3. Jeff KingDec 12, 2008
  4. Jeff KingDec 12, 2008
  5. Junio C HamanoDec 15, 2008
  6. Jeff KingDec 15, 2008

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.