diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-05-26 14:08:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-29 05:36:31 +0200 |
commit | ba4e356109e5bf2b86bde335128c0ab4161268a9 (patch) | |
tree | c505c3f75f31d6b5f00a1d29b41cf84fce6d1115 /diff-lib.c | |
parent | The fifth batch for 2.18 (diff) | |
download | git-ba4e356109e5bf2b86bde335128c0ab4161268a9.tar.xz git-ba4e356109e5bf2b86bde335128c0ab4161268a9.zip |
diff: ignore --ita-[in]visible-in-index when diffing worktree-to-tree
This option is supposed to fix the diff of "diff-files" (not reporting
ita entries as new files) and "diff-index --cached <tree>" (showing ita
entries as present in the index with empty content) but not
"diff-index <tree>".
When --ita-invisible-in-index is set on "git diff-index <tree>",
unpack_trees() will eventually call oneway_diff() on the ita entry
with the same code flow as "diff-index --cached <tree>". We want to
ignore the ita entry for "diff-index --cached <tree>" but not
"diff-index <tree>" since the latter will examine and produce a diff
based on worktree entry's (real) content, not ita index entry's
(empty) content.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
-rw-r--r-- | diff-lib.c | 8 |
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) |