💾 Archived View for ait.place › dot › bin › .local › bin › suckpatch.txt captured on 2022-04-28 at 18:11:00.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

#!/usr/bin/env bash

current=${PWD##*/}
if [ ! -d "$XDG_DATA_HOME/dot/suckless/${current}_diffs/" ];then
	echo "No patches"
	exit 1
fi

for i in $XDG_DATA_HOME/dot/suckless/${current}_diffs/*.diff ; do
	name=$(echo $i | sed -e 's/\/.*\///' -e 's/\.diff//' -e "s/${current}_//")
	echo -e "\nchecking out master\n"
	git checkout master &&
	echo -e "\ncreating branch $name\n"
	git branch $name &&
	echo -e "\nchecking out $name\n"
	git checkout $name &&
	echo -e "\napplying patch: $i\n"
	git apply "$i" &&
	echo -e "\naddding and committing\n"
	git add -A && git commit -m "$name"
done

git checkout master