@@ -31,7 +31,7 @@ usage()
3131
3232restore_branch ()
3333{
34- [[ -z " $_cbr " ] ] || git checkout " $_cbr "
34+ [ -z " $_cbr " ] || git checkout " $_cbr "
3535}
3636
3737# ## main() ###
@@ -47,9 +47,11 @@ while [ "$#" -gt 0 ]; do
4747 esac
4848done
4949
50- [[ -n " $_dev " ]] || usage 1
51- [[ -n " $_old " && -n " $_new " ]] || usage 2
52- [[ -n " $_os " ]] || _os=linux
50+ [ -n " $_dev " ] || usage 1
51+ if [ -z " $_old " ] || [ -z " $_new " ]; then
52+ usage 2
53+ fi
54+ [ -n " $_os " ] || _os=linux
5355
5456if [[ " $( head -1 Makefile 2> /dev/null) " != " # Makefile for Sphinx" * ]]
5557then
5860fi
5961
6062# do nothing if current workspace is not clean
61- if [[ -n " $( git status --porcelain --untracked-files=no) " ] ]
63+ if [ -n " $( git status --porcelain --untracked-files=no) " ]
6264then
6365 echo " Error: Current workspace has uncommitted changes"
6466 exit 4
@@ -72,17 +74,17 @@ if ! git cat-file -t "${_new}" > /dev/null 2>&1; then
7274fi
7375
7476# convert 'HEAD' to its commit ID
75- if [[ " $_new " == " HEAD" ] ]; then
77+ if [ " $_new " = " HEAD" ]; then
7678 _new=$( git rev-parse HEAD)
7779fi
78- if [[ " $_old " == " HEAD" ] ]; then
80+ if [ " $_old " = " HEAD" ]; then
7981 _old=$( git rev-parse HEAD)
8082fi
8183
8284
8385# get current branch name or commit ID
8486_cbr=$( git branch | sed -n ' /\* /s///p' )
85- if [[ $_cbr == " (HEAD detached" * ]]; then
87+ if [[ " $_cbr " == " (HEAD detached" * ]]; then
8688 _cbr=$( git rev-parse HEAD)
8789fi
8890
113115echo " Found $_num new build WARNING(s)."
114116echo
115117
116- if [[ $_num != " 0" ] ]; then
118+ if [ " $_num " != " 0" ]; then
117119 cat build/_new-warn.log
118120fi
119121
0 commit comments