Follow-up to #2605.
#2605 fixes executable-bit propagation for files that already exist in the destination. But files introduced by the template for the first time on a copier update run are still affected when core.fileMode=false:
- Template v2 adds a new
script.sh with 100755 in the index.
- Destination has
core.fileMode=false (Windows default, and a common opt-out elsewhere).
- copier writes the file,
chmods it on disk (invisible to git with fileMode=false), then calls _sync_git_index_executable_bit — which short-circuits because the file is untracked.
- The user's next
git add script.sh records 100644 because git ignores on-disk mode with fileMode=false. Exec bit is lost.
Suggested approach, from @sisp's review on #2605: run git add --intent-to-add <file> for new files introduced by the template. This registers an index entry (without a blob), after which git update-index --cacheinfo can set the correct mode. The intent-to-add marker is also a nice semantic signal that these files aren't random untracked content but deliberate template output.
This is a separate PR / changelog entry because it expands copier's update algorithm with a new feature, rather than fixing a regression on existing behavior.
Follow-up to #2605.
#2605 fixes executable-bit propagation for files that already exist in the destination. But files introduced by the template for the first time on a
copier updaterun are still affected whencore.fileMode=false:script.shwith100755in the index.core.fileMode=false(Windows default, and a common opt-out elsewhere).chmods it on disk (invisible to git withfileMode=false), then calls_sync_git_index_executable_bit— which short-circuits because the file is untracked.git add script.shrecords100644because git ignores on-disk mode withfileMode=false. Exec bit is lost.Suggested approach, from @sisp's review on #2605: run
git add --intent-to-add <file>for new files introduced by the template. This registers an index entry (without a blob), after whichgit update-index --cacheinfocan set the correct mode. The intent-to-add marker is also a nice semantic signal that these files aren't random untracked content but deliberate template output.This is a separate PR / changelog entry because it expands copier's update algorithm with a new feature, rather than fixing a regression on existing behavior.