Improve existing git helper scripts
This commit is contained in:
parent
06f4776be4
commit
7b4c245de3
@ -37,4 +37,8 @@ case "$#" in
|
|||||||
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ $BRANCH == "(no" ]]; then
|
||||||
|
echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$ORG $FORK $REPO $TARG $BRANCH"
|
echo "$ORG $FORK $REPO $TARG $BRANCH"
|
||||||
|
@ -2,7 +2,15 @@
|
|||||||
#
|
#
|
||||||
# mfinit
|
# mfinit
|
||||||
#
|
#
|
||||||
# Create the upstream repository for Marlin
|
# Create the upstream remote for a forked repository
|
||||||
#
|
#
|
||||||
|
|
||||||
git remote add upstream git@github.com:MarlinFirmware/Marlin.git
|
REPO=$(git remote get-url origin 2>/dev/null | sed -E 's/.*\/(.*)\.git/\1/')
|
||||||
|
|
||||||
|
if [[ -z $REPO ]]; then
|
||||||
|
echo "`basename $0`: No 'origin' remote found." 1>&2 ; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git remote add upstream "git@github.com:MarlinFirmware/$REPO.git"
|
||||||
|
|
||||||
|
git fetch upstream
|
@ -2,20 +2,15 @@
|
|||||||
#
|
#
|
||||||
# mfnew
|
# mfnew
|
||||||
#
|
#
|
||||||
# Create a new branch based on RCBugFix or dev a given branch name
|
# Create a new branch from the default target with the given name
|
||||||
#
|
#
|
||||||
|
|
||||||
MFINFO=$(mfinfo) || exit
|
MFINFO=$(mfinfo) || exit
|
||||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||||
TARG=${INFO[3]}
|
TARG=${INFO[3]}
|
||||||
|
|
||||||
if [[ ${INFO[4]} == "(no" ]]; then
|
|
||||||
echo "Branch is unavailable!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$#" in
|
case "$#" in
|
||||||
0 ) BRANCH=pr_for_$TARG-$(date +"%G-%d-%m|%H:%M:%S") ;;
|
0 ) BRANCH=pr_for_$TARG-$(date +"%G-%m-%d_%H.%M.%S") ;;
|
||||||
1 ) BRANCH=$1 ;;
|
1 ) BRANCH=$1 ;;
|
||||||
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
* ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
@ -15,11 +15,6 @@ REPO=${INFO[2]}
|
|||||||
TARG=${INFO[3]}
|
TARG=${INFO[3]}
|
||||||
BRANCH=${INFO[4]}
|
BRANCH=${INFO[4]}
|
||||||
|
|
||||||
if [[ $BRANCH == "(no" ]]; then
|
|
||||||
echo "Git is busy with merge, rebase, etc."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
|
if [[ ! -z "$1" ]]; then { BRANCH=$1 ; git checkout $1 || exit 1; } fi
|
||||||
|
|
||||||
if [[ $BRANCH == $TARG ]]; then
|
if [[ $BRANCH == $TARG ]]; then
|
||||||
|
@ -8,11 +8,6 @@
|
|||||||
MFINFO=$(mfinfo) || exit
|
MFINFO=$(mfinfo) || exit
|
||||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||||
|
|
||||||
if [[ ${INFO[4]} == "(no" ]]; then
|
|
||||||
echo "Branch is unavailable!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$#" in
|
case "$#" in
|
||||||
0 ) ;;
|
0 ) ;;
|
||||||
* ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;
|
* ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;;
|
||||||
|
@ -15,11 +15,6 @@ REPO=${INFO[2]}
|
|||||||
TARG=${INFO[3]}
|
TARG=${INFO[3]}
|
||||||
OLDBRANCH=${INFO[4]}
|
OLDBRANCH=${INFO[4]}
|
||||||
|
|
||||||
if [[ $OLDBRANCH == "(no" ]]; then
|
|
||||||
echo "Branch is unavailable!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$#" in
|
case "$#" in
|
||||||
0 ) BRANCH=$OLDBRANCH ;;
|
0 ) BRANCH=$OLDBRANCH ;;
|
||||||
1 ) BRANCH=$1 ;;
|
1 ) BRANCH=$1 ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user