11diff --git a/Makefile b/Makefile
2- index e504646..07c1f2c 100644
3- --- a/Makefile
4- +++ b/Makefile
5- @@ -19,6 +19,21 @@ versions:
6- fi \
7- done
8-
9- + create-patch:
10- + @mkdir -p patches
11- + @echo -e "\e[1;34m[+] Creating and splitting patch from latest commit...\e[0m"
12- + @git format-patch -1 HEAD --stdout | awk '\
13- + /^diff --git a\// { \
14- + if (out) close(out); \
15- + fname = $$3; \
16- + sub(/^a\//, "", fname); \
17- + gsub(/\//, "_", fname); \
18- + out = "patches/" fname ".patch"; \
19- + } \
20- + { if (out) print >> out } \
21- + '
22- + @echo -e "\e[1;32m[+] Individual patch files saved in patches/\e[0m"
23- +
24- PATCH:=./name.patch
25- patch:
26- @if [ -f ${PATCH} ]; then \
27- @@ -32,6 +47,16 @@ patch:
28- echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
29- fi
30-
31- + patch-all:
32- + @for patchfile in patches/*.patch; do \
33- + for f in $(wildcard */); do \
34- + if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
35- + echo -e "\e[1;35m[+] Patching $$f with $$patchfile\e[0m"; \
36- + patch -d $$f --backup-if-mismatch -p2 < "$$patchfile"; \
37- + fi \
38- + done \
39- + done
40- +
41- test:
42- @for DIR_NAME in $(wildcard */); do \
43- if [ -f $$DIR_NAME/Makefile ]; then \
44- diff --git a/Makefile b/Makefile
45- index e504646..07c1f2c 100644
46- --- a/Makefile
47- +++ b/Makefile
48- @@ -19,6 +19,21 @@ versions:
49- fi \
50- done
51-
52- + create-patch:
53- + @mkdir -p patches
54- + @echo -e "\e[1;34m[+] Creating and splitting patch from latest commit...\e[0m"
55- + @git format-patch -1 HEAD --stdout | awk '\
56- + /^diff --git a\// { \
57- + if (out) close(out); \
58- + fname = $$3; \
59- + sub(/^a\//, "", fname); \
60- + gsub(/\//, "_", fname); \
61- + out = "patches/" fname ".patch"; \
62- + } \
63- + { if (out) print >> out } \
64- + '
65- + @echo -e "\e[1;32m[+] Individual patch files saved in patches/\e[0m"
66- +
67- PATCH:=./name.patch
68- patch:
69- @if [ -f ${PATCH} ]; then \
70- @@ -32,6 +47,16 @@ patch:
71- echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
72- fi
73-
74- + patch-all:
75- + @for patchfile in patches/*.patch; do \
76- + for f in $(wildcard */); do \
77- + if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
78- + echo -e "\e[1;35m[+] Patching $$f with $$patchfile\e[0m"; \
79- + patch -d $$f --backup-if-mismatch -p2 < "$$patchfile"; \
80- + fi \
81- + done \
82- + done
83- +
84- test:
85- @for DIR_NAME in $(wildcard */); do \
86- if [ -f $$DIR_NAME/Makefile ]; then \
87- diff --git a/Makefile b/Makefile
88- index e504646..07c1f2c 100644
89- --- a/Makefile
90- +++ b/Makefile
91- @@ -19,6 +19,21 @@ versions:
92- fi \
93- done
94-
95- + create-patch:
96- + @mkdir -p patches
97- + @echo -e "\e[1;34m[+] Creating and splitting patch from latest commit...\e[0m"
98- + @git format-patch -1 HEAD --stdout | awk '\
99- + /^diff --git a\// { \
100- + if (out) close(out); \
101- + fname = $$3; \
102- + sub(/^a\//, "", fname); \
103- + gsub(/\//, "_", fname); \
104- + out = "patches/" fname ".patch"; \
105- + } \
106- + { if (out) print >> out } \
107- + '
108- + @echo -e "\e[1;32m[+] Individual patch files saved in patches/\e[0m"
109- +
110- PATCH:=./name.patch
111- patch:
112- @if [ -f ${PATCH} ]; then \
113- @@ -32,6 +47,16 @@ patch:
114- echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
115- fi
116-
117- + patch-all:
118- + @for patchfile in patches/*.patch; do \
119- + for f in $(wildcard */); do \
120- + if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
121- + echo -e "\e[1;35m[+] Patching $$f with $$patchfile\e[0m"; \
122- + patch -d $$f --backup-if-mismatch -p2 < "$$patchfile"; \
123- + fi \
124- + done \
125- + done
126- +
127- test:
128- @for DIR_NAME in $(wildcard */); do \
129- if [ -f $$DIR_NAME/Makefile ]; then \
130- diff --git a/Makefile b/Makefile
131- index 07c1f2c..49323ab 100644
132- --- a/Makefile
133- +++ b/Makefile
134- @@ -21,8 +21,8 @@ versions:
135-
136- create-patch:
137- @mkdir -p patches
138- - @echo -e "\e[1;34m[+] Creating and splitting patch from latest commit...\e[0m"
139- - @git format-patch -1 HEAD --stdout | awk '\
140- + @echo -e "\e[1;34m[+] Creating and splitting patch from latest commit (excluding patches/)...\e[0m"
141- + @git diff HEAD^ HEAD -- . ':(exclude)patches/' | awk '\
142- /^diff --git a\// { \
143- if (out) close(out); \
144- fname = $$3; \
145- diff --git a/Makefile b/Makefile
146- index e504646..c4ed576 100644
147- --- a/Makefile
148- +++ b/Makefile
149- @@ -19,6 +19,22 @@ versions:
150- fi \
151- done
152-
153- + create-patch:
154- + @mkdir -p patches
155- + @echo -e "\e[1;34m[+] Creating and splitting patch from branch 'cla' against 'main' (excluding patches/)...\e[0m"
156- + @git fetch origin main >/dev/null 2>&1
157- + @git diff origin/main...HEAD -- . ':(exclude)patches/' | awk '\
158- + /^diff --git a\// { \
159- + if (out) close(out); \
160- + fname = $$3; \
161- + sub(/^a\//, "", fname); \
162- + gsub(/\//, "_", fname); \
163- + out = "patches/" fname ".patch"; \
164- + } \
165- + { if (out) print >> out } \
166- + '
167- + @echo -e "\e[1;32m[+] Patch files saved to ./patches/\e[0m"
168- +
169- PATCH:=./name.patch
170- patch:
171- @if [ -f ${PATCH} ]; then \
172- @@ -32,6 +48,16 @@ patch:
173- echo -e "\e[1;31m[+] ${PATCH} file does not exist"; \
174- fi
175-
176- + patch-all:
177- + @for patchfile in patches/*.patch; do \
178- + for f in $(wildcard */); do \
179- + if [[ -d "$$f" && -f "$$f/Makefile" ]]; then \
180- + echo -e "\e[1;35m[+] Patching $$f with $$patchfile\e[0m"; \
181- + patch -d $$f --backup-if-mismatch -p2 < "$$patchfile"; \
182- + fi \
183- + done \
184- + done
185- +
186- test:
187- @for DIR_NAME in $(wildcard */); do \
188- if [ -f $$DIR_NAME/Makefile ]; then \
189- diff --git a/Makefile b/Makefile
190- index e504646..c4ed576 100644
2+ index e504646..4468b97 100644
1913--- a/Makefile
1924+++ b/Makefile
1935@@ -19,6 +19,22 @@ versions:
@@ -206,7 +18,7 @@ index e504646..c4ed576 100644
20618+ gsub(/\//, "_", fname); \
20719+ out = "patches/" fname ".patch"; \
20820+ } \
209- + { if (out) print >> out } \
21+ + { if (out) print > out } \
21022+ '
21123+ @echo -e "\e[1;32m[+] Patch files saved to ./patches/\e[0m"
21224+
0 commit comments