Description of Issue/Question
file.patch state is very useful for Linux to apply a "better GNU patch". But could not get it working for windows because of the underlying execution file.patch function requiring that "patch" executable is installed.
https://github.com/saltstack/salt/blob/develop/salt/modules/file.py#L2718
There is a "Patch for Windows" executable (http://gnuwin32.sourceforge.net/packages/patch.htm) but it seems pretty old and unlikely to support newer windows versions. Thinking that file.patch could leverage "git apply" to apply a "better GNU patch" for windows (if git is installed). The --unsafe-paths option could be used to patch files outside the git working area.
--unsafe-paths
By default, a patch that affects outside the working area (either a Git controlled working tree, or the current working directory when "git apply" is used as a replacement of GNU patch) is rejected as a mistake (or a mischief).
When git apply is used as a "better GNU patch", the user can pass the --unsafe-paths option to override this safety check. This option has no effect when --index or --cached is in use.
If file.patch is not correct place for this then I'd at least like to see "git apply" be functionality added under git execution modules (https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.git.html).
Relevant link:
https://stackoverflow.com/questions/19611/how-to-patch-on-windows
Description of Issue/Question
file.patch state is very useful for Linux to apply a "better GNU patch". But could not get it working for windows because of the underlying execution file.patch function requiring that "patch" executable is installed.
https://github.com/saltstack/salt/blob/develop/salt/modules/file.py#L2718
There is a "Patch for Windows" executable (http://gnuwin32.sourceforge.net/packages/patch.htm) but it seems pretty old and unlikely to support newer windows versions. Thinking that file.patch could leverage "git apply" to apply a "better GNU patch" for windows (if git is installed). The
--unsafe-pathsoption could be used to patch files outside the git working area.If file.patch is not correct place for this then I'd at least like to see "git apply" be functionality added under git execution modules (https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.git.html).
Relevant link:
https://stackoverflow.com/questions/19611/how-to-patch-on-windows