mfqp 682 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env bash
  2. #
  3. # mfqp [1|2]
  4. #
  5. # - git add .
  6. # - git commit --amend
  7. # - git push -f
  8. #
  9. MFINFO=$(mfinfo "$@") || exit 1
  10. IFS=' ' read -a INFO <<< "$MFINFO"
  11. REPO=${INFO[2]}
  12. TARG=${INFO[3]}
  13. CURR=${INFO[5]}
  14. IND=6
  15. while [ $IND -lt ${#INFO[@]} ]; do
  16. ARG=${INFO[$IND]}
  17. case "$ARG" in
  18. -f|--force ) FORCE=1 ;;
  19. -h|--help ) USAGE=1 ;;
  20. * ) USAGE=1 ; echo "unknown option: $ARG" ;;
  21. esac
  22. let IND+=1
  23. done
  24. [[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; }
  25. [[ $FORCE != 1 && $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; }
  26. git add . && git commit --amend && git push -f