diff options
| author | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-08-18 13:33:05 +0200 |
|---|---|---|
| committer | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-08-18 13:33:05 +0200 |
| commit | 5e45538355d28f374790a7ae22d32b79edd63431 (patch) | |
| tree | 552e503eea001d521a7b56acf593eff16caad40f /patches/dwmpatch | |
| parent | 5687f4696472ba6029bbba18e293e3e8b9e154ea (diff) | |
Autopatch script
Diffstat (limited to 'patches/dwmpatch')
| -rwxr-xr-x | patches/dwmpatch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/patches/dwmpatch b/patches/dwmpatch new file mode 100755 index 0000000..cf444c7 --- /dev/null +++ b/patches/dwmpatch @@ -0,0 +1,37 @@ +#!/bin/sh + +patch_name_from_fname() { + echo $1 | cut -d- -f2 +} + +apply_patch() { + branch="$1" + echo "" + git checkout -b $branch + cd .. > /dev/null + patch -p1 < patches/$1 || exit 1 + # git apply --reject patches/$1 || exit 1 + git add *.c *.h *.mk *.1 + cd - > /dev/null + git commit -m "Applied $1" + git switch -q master + return 0 +} + +git switch "patches" || exit +git reset --hard || exit + +# branches for individually applied patches +branches=$(git for-each-ref --format='%(refname:short)' refs/heads/ | grep diff) +for branch in $branches; do + git branch -D $branch || exit +done +# branch for merged patches +git branch -D patched + +for patchfile in *.diff; do + apply_patch "$patchfile" || exit +done + +git switch -c "patched" || exit +echo "Merge patch branches manually now" |
