aboutsummaryrefslogtreecommitdiffstats
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-25 13:22:36 -0700
committerJunio C Hamano <gitster@pobox.com>2018-06-25 13:22:36 -0700
commitac997db0c13d3acde8fcb6c79ff095ba6bd27169 (patch)
tree3a1294218762ac16d06596c8ab3ac342103bfd99 /diff-lib.c
parentMerge branch 'ds/commit-graph-lockfile-fix' (diff)
parentapply: add --intent-to-add (diff)
downloadgit-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.tar.gz
git-ac997db0c13d3acde8fcb6c79ff095ba6bd27169.zip
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 'diff-lib.c')
-rw-r--r--diff-lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 104f954a25..a9f38eb5a3 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -389,8 +389,12 @@ static void do_oneway_diff(struct unpack_trees_options *o,
struct rev_info *revs = o->unpack_data;
int match_missing, cached;
- /* i-t-a entries do not actually exist in the index */
- if (revs->diffopt.ita_invisible_in_index &&
+ /*
+ * i-t-a entries do not actually exist in the index (if we're
+ * looking at its content)
+ */
+ if (o->index_only &&
+ revs->diffopt.ita_invisible_in_index &&
idx && ce_intent_to_add(idx)) {
idx = NULL;
if (!tree)