summaryrefslogtreecommitdiff
path: root/builtin/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-07 00:59:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-07 00:59:59 (GMT)
commit12e5bdd9c4bfa0131b00b20be2cc48a8e2b08a2d (patch)
treefba33edaee8716bf482f11de261f6af23568636a /builtin/diff.c
parent68731c7ec780f1ad1c08d9c9c7d297cdc553a118 (diff)
parent287ab28bfae14431f3f57abeb92149c460044850 (diff)
downloadgit-12e5bdd9c4bfa0131b00b20be2cc48a8e2b08a2d.zip
git-12e5bdd9c4bfa0131b00b20be2cc48a8e2b08a2d.tar.gz
git-12e5bdd9c4bfa0131b00b20be2cc48a8e2b08a2d.tar.bz2
Merge branch 'jk/diff-no-index-initialize'
"git diff --no-index" may still want to access Git goodies like --ext-diff and --textconv, but so far these have been ignored, which has been corrected. * jk/diff-no-index-initialize: diff: reuse diff setup for --no-index case
Diffstat (limited to 'builtin/diff.c')
-rw-r--r--builtin/diff.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/builtin/diff.c b/builtin/diff.c
index 9f61092..53d4234 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -338,21 +338,23 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
"--no-index" : "[--no-index]");
}
- if (no_index)
- /* If this is a no-index diff, just run it and exit there. */
- diff_no_index(the_repository, &rev, argc, argv);
-
- /* Otherwise, we are doing the usual "git" diff */
- rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
- /* Scale to real terminal size and respect statGraphWidth config */
+ /* Set up defaults that will apply to both no-index and regular diffs. */
rev.diffopt.stat_width = -1;
rev.diffopt.stat_graph_width = -1;
-
- /* Default to let external and textconv be used */
rev.diffopt.flags.allow_external = 1;
rev.diffopt.flags.allow_textconv = 1;
+ /* If this is a no-index diff, just run it and exit there. */
+ if (no_index)
+ diff_no_index(&rev, argc, argv);
+
+ /*
+ * Otherwise, we are doing the usual "git" diff; set up any
+ * further defaults that apply to regular diffs.
+ */
+ rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;
+
/*
* Default to intent-to-add entries invisible in the
* index. This makes them show up as new files in diff-files