summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-06-25 13:22:36 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-06-25 13:22:36 -0700
commitac997db0c13d3acde8fcb6c79ff095ba6bd27169 (patch)
tree3a1294218762ac16d06596c8ab3ac342103bfd99 /builtin
parentMerge branch 'ds/commit-graph-lockfile-fix' (diff)
parentapply: add --intent-to-add (diff)
downloadtgif-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.tar.xz
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')
-rw-r--r--builtin/diff.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/diff.c b/builtin/diff.c
index bfefff3a84..b709b6e984 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);