Skip to content

pr-1620/Chand-ra/devel-v2

From: Chandra Pratap <chandrapratap3519@gmail.com>

When applying a patch that adds an executable file, git apply
ignores the core.fileMode setting (core.fileMode in git config
specifies whether the executable bit on files in the working tree
should be honored or not) resulting in warnings like:

warning: script.sh has type 100644, expected 100755

even when core.fileMode is set to false, which is undesired. This
is extra true for systems like Windows, which don't rely on "lsat()".

Fix this by inferring the correct file mode from the existing
index entry when core.filemode is set to false. The added
test case helps verify the change and prevents future regression.

Reviewed-by: Johannes Schindelin <johannes.schindelin@gmail.com>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>

Submitted-As: https://lore.kernel.org/git/pull.1620.v2.git.1703010646036.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.1620.git.1702908568890.gitgitgadget@gmail.com
Assets 2