Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-22 21:54:47 +0400
committerJunio C Hamano <gitster@pobox.com>2011-09-22 21:54:47 +0400
commitf01cae918feb564da8c7a286b32c7c917599acdd (patch)
tree10766f44cc26f8d4183786515ea4a6236ded411c /diff.c
parent87b50542a08ac6caa083ddc376e674424e37940a (diff)
diff: teach --stat/--numstat to honor -U$num
"git diff -p" piped to external diffstat and "git diff --stat" may see different patch text (both are valid and describe the same change correctly) when counting the number of added and deleted lines, arriving at different results to confuse the users, as --stat/--numstat codepath always uses the hardcoded -U0 as the context length. Make --stat/--numstat codepath to honor the context length the same way as the textual patch codepath does to avoid this problem. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 9a5c77c13f..d442c66e96 100644
--- a/diff.c
+++ b/diff.c
@@ -2096,6 +2096,8 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
memset(&xpp, 0, sizeof(xpp));
memset(&xecfg, 0, sizeof(xecfg));
xpp.flags = o->xdl_opts;
+ xecfg.ctxlen = o->context;
+ xecfg.interhunkctxlen = o->interhunkcontext;
xdi_diff_outf(&mf1, &mf2, diffstat_consume, diffstat,
&xpp, &xecfg);
}