Skip to content

Commit cb0dd22

Browse files
jupedgitster
authored andcommitted
diff-lib: use worktree mode in diffs from i-t-a entries
When creating "new file" diffs against i-t-a index entries, diff-lib erroneously used the mode of the cache entry rather than the mode of the file in the worktree. This changes run_diff_files() to correctly use the mode of the worktree file in this case. Signed-off-by: Raymond E. Pasco <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3080c50 commit cb0dd22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

diff-lib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
219219
continue;
220220
} else if (revs->diffopt.ita_invisible_in_index &&
221221
ce_intent_to_add(ce)) {
222-
diff_addremove(&revs->diffopt, '+', ce->ce_mode,
222+
newmode = ce_mode_from_stat(ce, st.st_mode);
223+
diff_addremove(&revs->diffopt, '+', newmode,
223224
&null_oid, 0, ce->name, 0);
224225
continue;
225226
}

0 commit comments

Comments
 (0)