Skip to content

Commit 4b555ea

Browse files
committed
apply: symbolic links lack a "trustable executable bit"
When 0482c32 (apply: ignore working tree filemode when !core.filemode, 2023-12-26) fixed `git apply` to stop warning about executable files, it inadvertently changed the code flow also for symbolic links and directories. Let's narrow the scope of the special `!trust_executable_git` code path to apply only to regular files. This is needed to let t4115.5(symlink escape when creating new files) pass on Windows when symbolic link support is enabled in the MSYS2 runtime. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 44ada84 commit 4b555ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ static int check_preimage(struct apply_state *state,
37773777
if (*ce && !(*ce)->ce_mode)
37783778
BUG("ce_mode == 0 for path '%s'", old_name);
37793779

3780-
if (trust_executable_bit)
3780+
if (trust_executable_bit || !S_ISREG(st->st_mode))
37813781
st_mode = ce_mode_from_stat(*ce, st->st_mode);
37823782
else if (*ce)
37833783
st_mode = (*ce)->ce_mode;

0 commit comments

Comments
 (0)