2018-02-11 09:16:29 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2021-11-03 13:02:21 +01:00
|
|
|
# mffp [1|2] [ref]
|
2018-02-11 09:16:29 +01:00
|
|
|
#
|
|
|
|
# Push the given commit (or HEAD) upstream immediately.
|
2022-06-04 06:50:20 +02:00
|
|
|
# By default: `git push upstream HEAD:bugfix-2.1.x`
|
2018-02-11 09:16:29 +01:00
|
|
|
#
|
|
|
|
|
2021-12-27 21:28:59 +01:00
|
|
|
usage() { echo "usage: `basename $0` [1|2] [ref]" 1>&2 ; }
|
2018-02-11 09:16:29 +01:00
|
|
|
|
2021-11-03 13:02:21 +01:00
|
|
|
[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage ; exit 1; }
|
|
|
|
|
|
|
|
if [[ $1 == '1' || $1 == '2' ]]; then
|
2018-02-11 09:16:29 +01:00
|
|
|
MFINFO=$(mfinfo "$1") || exit 1
|
|
|
|
REF=${2:-HEAD}
|
2021-11-03 13:02:21 +01:00
|
|
|
elif [[ $# == 1 ]]; then
|
2018-02-11 09:16:29 +01:00
|
|
|
MFINFO=$(mfinfo) || exit 1
|
|
|
|
REF=${1:-HEAD}
|
2021-11-03 13:02:21 +01:00
|
|
|
else
|
2021-12-27 21:28:59 +01:00
|
|
|
usage ; exit 1
|
2018-02-11 09:16:29 +01:00
|
|
|
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
|