aboutsummaryrefslogtreecommitdiff
path: root/buildroot/share/git/mffp
blob: 2663a4a1374e7ec5284c71d3d06264caaec95888 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
#
# mffp [1|2|3] [commit-id]
#
# Push the given commit (or HEAD) upstream immediately.
# By default: `git push upstream HEAD:bugfix-1.1.x`
#

[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2|3] [commit-id]" 1>&2 ; exit 1; }

if [[ $1 == '1' || $1 == '2' || $1 == '3' ]]; 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