#!/bin/bash PATCHNAME="$1" ROOT=`git rev-parse --show-toplevel` if [ "$PATCHNAME" == "" ]; then echo "missing patch/branch name" exit 1 fi if [ ! -f "$ROOT/../../HarveyOS-Shamar/patches/$PATCHNAME.patch" ]; then echo "cannot find HarveyOS-Shamar/patches/$PATCHNAME.patch" exit 2 fi git checkout -B $PATCHNAME master git apply "$ROOT/../../HarveyOS-Shamar/patches/$PATCHNAME.patch" git add . git add -A if git commit -s; then git push else git clean -d -x -f git reset HEAD git apply --reverse "$ROOT/../../HarveyOS-Shamar/patches/$PATCHNAME.patch" fi echo $PATCHNAME