summaryrefslogtreecommitdiff
path: root/patches/dwmpatch
blob: 59060c48b056c96bf5eb58871fc9e0a520a22607 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/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"
	return 0
}

git switch "patches" || exit
git reset --hard "patches" -- || exit
git clean -fd "../"

# 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
# branc with merged patches
git branch -D patched

git status
for patchfile in *.diff; do
	git switch -q "patches"
	apply_patch "$patchfile" || (git switch "patches" && exit)
done

git checkout -b "patched"
echo "Merge patch branches manually now"