diff --git a/buildroot/share/git/mfinfo b/buildroot/share/git/mfinfo index 533b30a56..84b067cae 100755 --- a/buildroot/share/git/mfinfo +++ b/buildroot/share/git/mfinfo @@ -37,4 +37,8 @@ case "$#" in * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;; esac +if [[ $BRANCH == "(no" ]]; then + echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1 +fi + echo "$ORG $FORK $REPO $TARG $BRANCH" diff --git a/buildroot/share/git/mfinit b/buildroot/share/git/mfinit index 5e2cbc0d8..2a3791460 100755 --- a/buildroot/share/git/mfinit +++ b/buildroot/share/git/mfinit @@ -2,7 +2,15 @@ # # 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 \ No newline at end of file diff --git a/buildroot/share/git/mfnew b/buildroot/share/git/mfnew index 0a07513bf..7f3d7876c 100755 --- a/buildroot/share/git/mfnew +++ b/buildroot/share/git/mfnew @@ -2,20 +2,15 @@ # # 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 IFS=' ' read -a INFO <<< "$MFINFO" TARG=${INFO[3]} -if [[ ${INFO[4]} == "(no" ]]; then - echo "Branch is unavailable!" - exit 1 -fi - 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 ;; * ) echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1 ;; esac diff --git a/buildroot/share/git/mfpr b/buildroot/share/git/mfpr index 8eff48483..eb2e102ae 100755 --- a/buildroot/share/git/mfpr +++ b/buildroot/share/git/mfpr @@ -15,11 +15,6 @@ REPO=${INFO[2]} TARG=${INFO[3]} 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 [[ $BRANCH == $TARG ]]; then diff --git a/buildroot/share/git/mfrb b/buildroot/share/git/mfrb index c1366f7f9..b0b700868 100755 --- a/buildroot/share/git/mfrb +++ b/buildroot/share/git/mfrb @@ -8,11 +8,6 @@ MFINFO=$(mfinfo) || exit IFS=' ' read -a INFO <<< "$MFINFO" -if [[ ${INFO[4]} == "(no" ]]; then - echo "Branch is unavailable!" - exit 1 -fi - case "$#" in 0 ) ;; * ) echo "Usage: `basename $0`" 1>&2 ; exit 1 ;; diff --git a/buildroot/share/git/mfup b/buildroot/share/git/mfup index ff19e0e1c..8d339c068 100755 --- a/buildroot/share/git/mfup +++ b/buildroot/share/git/mfup @@ -15,11 +15,6 @@ REPO=${INFO[2]} TARG=${INFO[3]} OLDBRANCH=${INFO[4]} -if [[ $OLDBRANCH == "(no" ]]; then - echo "Branch is unavailable!" - exit 1 -fi - case "$#" in 0 ) BRANCH=$OLDBRANCH ;; 1 ) BRANCH=$1 ;;