summaryrefslogtreecommitdiff
path: root/builtin/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-25 20:22:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-25 20:22:36 (GMT)
commitac997db0c13d3acde8fcb6c79ff095ba6bd27169 (patch)
tree3a1294218762ac16d06596c8ab3ac342103bfd99 /builtin/diff.c
parenta856e7d69f51776e40633d6f1f1f38a7fd64f0d5 (diff)
parentcff5dc09ed0d07461bf77e9abef57dc86a11ab77 (diff)
downloadgit-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.zip
git-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.tar.gz
git-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.tar.bz2
Merge branch 'nd/diff-apply-ita'
"git diff" compares the index and the working tree. For paths added with intent-to-add bit, the command shows the full contents of them as added, but the paths themselves were not marked as new files. They are now shown as new by default. "git apply" learned the "--intent-to-add" option so that an otherwise working-tree-only application of a patch will add new paths to the index marked with the "intent-to-add" bit. * nd/diff-apply-ita: apply: add --intent-to-add t2203: add a test about "diff HEAD" case diff: turn --ita-invisible-in-index on by default diff: ignore --ita-[in]visible-in-index when diffing worktree-to-tree
Diffstat (limited to 'builtin/diff.c')
-rw-r--r--builtin/diff.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/diff.c b/builtin/diff.c
index bfefff3..b709b6e 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -352,6 +352,13 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
rev.diffopt.flags.allow_external = 1;
rev.diffopt.flags.allow_textconv = 1;
+ /*
+ * Default to intent-to-add entries invisible in the
+ * index. This makes them show up as new files in diff-files
+ * and not at all in diff-cached.
+ */
+ rev.diffopt.ita_invisible_in_index = 1;
+
if (nongit)
die(_("Not a git repository"));
argc = setup_revisions(argc, argv, &rev, NULL);