mirror of https://github.com/zulip/zulip.git
deploy-branch: Fix shellcheck warnings.
In tools/deploy-branch line 17: [ $? -ne 0 ] && error_out "Unknown branch: $branch" ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. In tools/deploy-branch line 23: if [ $? -eq 0 ]; then ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. In tools/deploy-branch line 35: [ $? -ne 0 ] && error_out "Rebase onto origin/master failed" ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. In tools/deploy-branch line 39: [ $? -ne 0 ] && error_out "Push of master to origin/master failed" ^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
4a8074000c
commit
c63d852b55
|
@ -12,15 +12,12 @@ status=$(git status --porcelain | grep -v '^??')
|
||||||
|
|
||||||
old_ref=$(git rev-list --max-count=1 HEAD)
|
old_ref=$(git rev-list --max-count=1 HEAD)
|
||||||
branch=$1
|
branch=$1
|
||||||
branch_ref=$(git rev-list --max-count=1 "$branch")
|
branch_ref=$(git rev-list --max-count=1 "$branch") || error_out "Unknown branch: $branch"
|
||||||
|
|
||||||
[ $? -ne 0 ] && error_out "Unknown branch: $branch"
|
|
||||||
|
|
||||||
if [ "$old_ref" == "$branch_ref" ]; then
|
if [ "$old_ref" == "$branch_ref" ]; then
|
||||||
new_ref=master
|
new_ref=master
|
||||||
else
|
else
|
||||||
ref_name=$(git describe --all --exact "$old_ref")
|
if ref_name=$(git describe --all --exact "$old_ref"); then
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
new_ref=$(echo "$ref_name" | perl -pe 's{^(heads|remotes)/}{}')
|
new_ref=$(echo "$ref_name" | perl -pe 's{^(heads|remotes)/}{}')
|
||||||
else
|
else
|
||||||
new_ref=$old_ref
|
new_ref=$old_ref
|
||||||
|
@ -31,12 +28,10 @@ fi
|
||||||
|
|
||||||
git fetch -p
|
git fetch -p
|
||||||
|
|
||||||
git rebase origin/master "$branch"
|
git rebase origin/master "$branch" || error_out "Rebase onto origin/master failed"
|
||||||
[ $? -ne 0 ] && error_out "Rebase onto origin/master failed"
|
|
||||||
|
|
||||||
git push . HEAD:master
|
git push . HEAD:master
|
||||||
git push origin master
|
git push origin master || error_out "Push of master to origin/master failed"
|
||||||
[ $? -ne 0 ] && error_out "Push of master to origin/master failed"
|
|
||||||
|
|
||||||
git checkout "$new_ref"
|
git checkout "$new_ref"
|
||||||
git branch -D "$branch"
|
git branch -D "$branch"
|
||||||
|
|
Loading…
Reference in New Issue