Browse Source

Add --quick option to mfqp, add BRANCH check to mfinfo

Scott Lahteine 5 years ago
parent
commit
6fe39e6117
2 changed files with 20 additions and 6 deletions
  1. 4
    3
      buildroot/share/git/mfinfo
  2. 16
    3
      buildroot/share/git/mfqp

+ 4
- 3
buildroot/share/git/mfinfo View File

12
 #   - Current Branch
12
 #   - Current Branch
13
 #
13
 #
14
 
14
 
15
-# usage() { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; }
16
-# [[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage; exit 1; }
17
-
18
 CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
15
 CURR=$(git branch 2>/dev/null | grep ^* | sed 's/\* //g')
19
 [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; }
16
 [[ -z $CURR ]] && { echo "No git repository here!" 1>&2 ; exit 1; }
20
 [[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; }
17
 [[ $CURR == "(no"* ]] && { echo "Git is busy with merge, rebase, etc." 1>&2 ; exit 1; }
56
   MarlinDocumentation ) TARG=master ;;
53
   MarlinDocumentation ) TARG=master ;;
57
 esac
54
 esac
58
 
55
 
56
+[[ $BRANCH =~ ^[0-9]$ ]] && USAGE=1
57
+
58
+[[ $USAGE ]] && { echo "usage: `basename $0` [1|2] [branch]" 1>&2 ; exit 1 ; }
59
+
59
 echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE"
60
 echo "$ORG $FORK $REPO $TARG $BRANCH $CURR $MORE"

+ 16
- 3
buildroot/share/git/mfqp View File

5
 # Add all changed files, commit as "patch", do `mfrb` and `git push -f`
5
 # Add all changed files, commit as "patch", do `mfrb` and `git push -f`
6
 #
6
 #
7
 
7
 
8
-[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1; }
9
-
10
 MFINFO=$(mfinfo "$@") || exit 1
8
 MFINFO=$(mfinfo "$@") || exit 1
11
 IFS=' ' read -a INFO <<< "$MFINFO"
9
 IFS=' ' read -a INFO <<< "$MFINFO"
12
 REPO=${INFO[2]}
10
 REPO=${INFO[2]}
13
 TARG=${INFO[3]}
11
 TARG=${INFO[3]}
14
 CURR=${INFO[5]}
12
 CURR=${INFO[5]}
15
 
13
 
14
+IND=6
15
+while [ $IND -lt ${#INFO[@]} ]; do
16
+  ARG=${INFO[$IND]}
17
+  case "$ARG" in
18
+    -q|--quick ) QUICK="-q" ;;
19
+     -h|--help ) USAGE=1 ;;
20
+             * ) USAGE=1 ; echo "unknown option: $ARG" ;;
21
+  esac
22
+  let IND+=1
23
+done
24
+
25
+[[ ${INFO[4]} =~ [0-9] ]] && USAGE=1
26
+
27
+[[ $USAGE ]] && { echo "usage: `basename $0` [1|2]" 1>&2 ; exit 1 ; }
28
+
16
 git add .
29
 git add .
17
 git commit -m "patch"
30
 git commit -m "patch"
18
 
31
 
23
     echo "Don't alter the PR Target branch."; exit 1
36
     echo "Don't alter the PR Target branch."; exit 1
24
   fi
37
   fi
25
 else
38
 else
26
-  mfrb "$@" && git push -f
39
+  mfrb $QUICK "$@" && git push -f
27
 fi
40
 fi

Loading…
Cancel
Save