mffp 633 B

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