Created
July 28, 2015 00:43
-
-
Save Shamar/1f818b47138b0bc21c29 to your computer and use it in GitHub Desktop.
Revisions
-
Shamar created this gist
Jul 28, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/bash if [ ! -d ".git" ]; then echo "`pwd` is not a git repo" exit 3 fi STATUS=`git status -b --porcelain` STATUSL=`git status -b --porcelain|wc -l` BRANCH=`git status -b --porcelain | head -1|tr -d '# '` ROOT=`git rev-parse --show-toplevel` if [ "$STATUSL" -gt "1" ]; then echo "branch $BRANCH not clean" exit 1 fi if [ "$BRANCH" == "master" ]; then echo "cannot create patch from master branch" exit 2 fi git diff master..$BRANCH > $ROOT/../patches/$BRANCH.patch This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/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