Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond E. Pasco <ray@ameretat.dev>2020-08-08 10:53:23 +0300
committerJunio C Hamano <gitster@pobox.com>2020-08-09 21:14:29 +0300
commitcb0dd22b827a0533a8ba105764388269e59d010c (patch)
tree5c79283df944289084e0b2943336dc8767933528 /diff-lib.c
parent3080c5098049228cd561f08ee4cc31839251d579 (diff)
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 <ray@ameretat.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 25fd2dee19..50521e2093 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -219,7 +219,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
} else if (revs->diffopt.ita_invisible_in_index &&
ce_intent_to_add(ce)) {
- diff_addremove(&revs->diffopt, '+', ce->ce_mode,
+ newmode = ce_mode_from_stat(ce, st.st_mode);
+ diff_addremove(&revs->diffopt, '+', newmode,
&null_oid, 0, ce->name, 0);
continue;
}