2018-02-11 02:16:29 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2019-06-26 03:03:39 -05:00
|
|
|
# mffp [1|2] [commit-id]
|
2018-02-11 02:16:29 -06:00
|
|
|
#
|
|
|
|
# Push the given commit (or HEAD) upstream immediately.
|
|
|
|
# By default: `git push upstream HEAD:bugfix-1.1.x`
|
|
|
|
#
|
|
|
|
|
2019-01-23 23:05:42 -06:00
|
|
|
[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2] [commit-id]" 1>&2 ; exit 1; }
|
2018-02-11 02:16:29 -06:00
|
|
|
|
|
|
|
if [[ $1 == '1' || $1 == '2' ]]; then
|
|
|
|
MFINFO=$(mfinfo "$1") || exit 1
|
|
|
|
REF=${2:-HEAD}
|
|
|
|
else
|
|
|
|
MFINFO=$(mfinfo) || exit 1
|
|
|
|
REF=${1:-HEAD}
|
|
|
|
fi
|
|
|
|
|
|
|
|
IFS=' ' read -a INFO <<< "$MFINFO"
|
|
|
|
ORG=${INFO[0]}
|
|
|
|
TARG=${INFO[3]}
|
|
|
|
|
|
|
|
if [[ $ORG == "MarlinFirmware" ]]; then
|
|
|
|
git push upstream $REF:$TARG
|
|
|
|
else
|
|
|
|
echo "Not a MarlinFirmware working copy."; exit 1
|
|
|
|
fi
|