Browse Source

Add 'mffp' to quickly push upstream (#9587)

Scott Lahteine 6 years ago
parent
commit
47e56afeeb
No account linked to committer's email address
1 changed files with 27 additions and 0 deletions
  1. 27
    0
      buildroot/share/git/mffp

+ 27
- 0
buildroot/share/git/mffp View File

@@ -0,0 +1,27 @@
1
+#!/usr/bin/env bash
2
+#
3
+# mffp
4
+#
5
+# Push the given commit (or HEAD) upstream immediately.
6
+# By default: `git push upstream HEAD:bugfix-1.1.x`
7
+#
8
+
9
+[[ $# < 3 ]] || { echo "Usage: `basename $0` [1|2] [commit-id]" 1>&2 ; exit 1; }
10
+
11
+if [[ $1 == '1' || $1 == '2' ]]; then
12
+  MFINFO=$(mfinfo "$1") || exit 1
13
+  REF=${2:-HEAD}
14
+else
15
+  MFINFO=$(mfinfo) || exit 1
16
+  REF=${1:-HEAD}
17
+fi
18
+
19
+IFS=' ' read -a INFO <<< "$MFINFO"
20
+ORG=${INFO[0]}
21
+TARG=${INFO[3]}
22
+
23
+if [[ $ORG == "MarlinFirmware" ]]; then
24
+  git push upstream $REF:$TARG
25
+else
26
+  echo "Not a MarlinFirmware working copy."; exit 1
27
+fi

Loading…
Cancel
Save