summaryrefslogtreecommitdiff
path: root/scripts/update-patches-git
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/update-patches-git')
-rw-r--r--scripts/update-patches-git31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/update-patches-git b/scripts/update-patches-git
new file mode 100644
index 000000000..8337fa847
--- /dev/null
+++ b/scripts/update-patches-git
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+#
+# Update patches using git-format-patch from a source tree prepared by
+# patch_git.sh.
+#
+# (c) 2016 Phil Sutter <phil@nwl.cc>
+
+wrkdist=$1
+wd=$(pwd)
+
+cd "$wrkdist"
+top=""
+top_series=""
+git log --grep="^OpenADK patch marker:" --oneline | while read hash subject; do
+ [ -n "$top" ] || {
+ top=$hash
+ top_series="${subject#OpenADK patch marker: }"
+ continue
+ }
+ bottom=$hash
+ bottom_series="${subject#OpenADK patch marker: }"
+
+ patchdir=$(<.git/patch_tmp/${top_series}/__patchdir__)
+ while read patchfile; do
+ rm ${patchdir}/$patchfile
+ done < .git/patch_tmp/${top_series}/__patchfiles__
+ git format-patch -N -o "$patchdir" ${bottom}..${top}
+
+ top=$bottom
+ top_series=$bottom_series
+done