1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00
MarlinFirmware/buildroot/share/git/mffp

32 lines
656 B
Plaintext
Raw Normal View History

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