diff --git a/pkg/chezmoi/sourcestate.go b/pkg/chezmoi/sourcestate.go index 4e8f1969c46..bdb2d713a1c 100644 --- a/pkg/chezmoi/sourcestate.go +++ b/pkg/chezmoi/sourcestate.go @@ -2157,6 +2157,7 @@ func (s *SourceState) readExternalDir( TargetName: fileInfo.Name(), Type: SourceFileTypeFile, Empty: true, + Executable: isExecutable(fileInfo), Private: isPrivate(fileInfo), ReadOnly: isReadOnly(fileInfo), } diff --git a/pkg/cmd/testdata/scripts/issue2964.txtar b/pkg/cmd/testdata/scripts/issue2964.txtar new file mode 100644 index 00000000000..2eacf91f6cb --- /dev/null +++ b/pkg/cmd/testdata/scripts/issue2964.txtar @@ -0,0 +1,11 @@ +[windows] skip 'UNIX only' + +chmod 755 $CHEZMOISOURCEDIR/external_dot_dir/executable + +# test that external_ directories respect the executable bit +exec chezmoi apply +[umask:002] cmpmod 775 $HOME/.dir/executable +[umask:022] cmpmod 755 $HOME/.dir/executable + +-- home/user/.local/share/chezmoi/external_dot_dir/executable -- +# contents of .dir/executable