neilbrown / wiggle

apply rejected patches and perform word-wise diffs
http://neil.brown.name/wiggle
GNU General Public License v2.0
91 stars 8 forks source link

Preserve file mode when using doing --merge --replace #15

Closed gobenji closed 4 years ago

gobenji commented 5 years ago

Just a small issue I noticed with wiggle. I was wondering how come my scripts were loosing their executable bit... When using wiggle --replace, it creates the new merged file with 600 permission. (I thought it followed umask but it seems more restrictive in fact.) I would argue it should copy the mode of the original file:

ben@f1:~/local/src/kernel-source/scripts/git_sort$ l merge_tool.py
-rwxr-xr-x 1 ben ben 7.2K Aug 18 10:32 merge_tool.py
ben@f1:~/local/src/kernel-source/scripts/git_sort$ wiggle --replace merge_tool.py
1 unresolved conflict found
ben@f1:~/local/src/kernel-source/scripts/git_sort$ l merge_tool.py
-rw------- 1 ben ben 6.4K Aug 18 10:33 merge_tool.py
ben@f1:~/local/src/kernel-source/scripts/git_sort$ umask
0022
neilbrown commented 4 years ago

thanks. Passing the full st_mode to fchmod() seems a bit odd - I would rather mask out just the permission bits. But it doesn't matter in practice, so I took it as it is.