From faeb574ed195bee0e2c5a1c5cf63df5f940e0cee Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Wed, 12 Aug 2020 11:00:10 +0200
Subject: [PATCH] Fixing patch behavior to allow renaming files using 'git
 apply' instead of 'patch'

---
 configure/E3/DEFINES_FT      | 9 ++++-----
 configure/modules/DEFINES_FT | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/configure/E3/DEFINES_FT b/configure/E3/DEFINES_FT
index 7d59b000..78c71e17 100644
--- a/configure/E3/DEFINES_FT
+++ b/configure/E3/DEFINES_FT
@@ -16,22 +16,20 @@ endef
 define patch_site
 for i in $(wildcard $(TOP)/patch/Site/$(E3_MODULE_VERSION)-*.p0.patch); do\
 	printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
-	patch -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+	git apply --directory=$(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 $$i;\
 done
 endef
 
 
 define patch_revert_site
 for i in $(wildcard $(TOP)/patch/Site/$(E3_MODULE_VERSION)-*.p0.patch); do\
-	printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
-	patch -R -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+	printf "\nReverting applied patch %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
+	git apply -R --directory=$(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 $$i;\
 done
 
-
 endef
 
 
-
 ifndef VERBOSE
   QUIET := @
 endif
@@ -48,3 +46,4 @@ VARS_EXCLUDES+=patch_site
 VARS_EXCLUDES+=patch_revert_site
 VARS_EXCLUDES+=QUIET
 VARS_EXCLUDES+=SHELL
+
diff --git a/configure/modules/DEFINES_FT b/configure/modules/DEFINES_FT
index c1432254..78c71e17 100644
--- a/configure/modules/DEFINES_FT
+++ b/configure/modules/DEFINES_FT
@@ -16,7 +16,7 @@ endef
 define patch_site
 for i in $(wildcard $(TOP)/patch/Site/$(E3_MODULE_VERSION)-*.p0.patch); do\
 	printf "\nPatching %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
-	patch -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+	git apply --directory=$(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 $$i;\
 done
 endef
 
@@ -24,7 +24,7 @@ endef
 define patch_revert_site
 for i in $(wildcard $(TOP)/patch/Site/$(E3_MODULE_VERSION)-*.p0.patch); do\
 	printf "\nReverting applied patch %s with the file : %s\n" "$(E3_MODULE_SRC_PATH)" "$$i"; \
-	patch -R -d $(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 < $$i;\
+	git apply -R --directory=$(E3_MODULE_SRC_PATH) --ignore-whitespace -p0 $$i;\
 done
 
 endef
-- 
GitLab