浏览代码

Merge branch 'tor-github/pr/1263'

George Kadianakis 6 年之前
父节点
当前提交
859514d477
共有 1 个文件被更改,包括 15 次插入8 次删除
  1. 15 8
      scripts/git/git-push-all.sh

+ 15 - 8
scripts/git/git-push-all.sh

@@ -15,30 +15,37 @@ UPSTREAM_REMOTE=${TOR_UPSTREAM_REMOTE_NAME:-"upstream"}
 # Add a delay between pushes, so CI runs on the most important branches first
 # Add a delay between pushes, so CI runs on the most important branches first
 PUSH_DELAY=${TOR_PUSH_DELAY:-0}
 PUSH_DELAY=${TOR_PUSH_DELAY:-0}
 
 
-PUSH_BRANCHES=`echo \
+PUSH_BRANCHES=$(echo \
   master \
   master \
   {release,maint}-0.4.1 \
   {release,maint}-0.4.1 \
   {release,maint}-0.4.0 \
   {release,maint}-0.4.0 \
   {release,maint}-0.3.5 \
   {release,maint}-0.3.5 \
   {release,maint}-0.2.9 \
   {release,maint}-0.2.9 \
-  `
+  )
 
 
 if [ "$PUSH_DELAY" -le 0 ]; then
 if [ "$PUSH_DELAY" -le 0 ]; then
   echo "Pushing $PUSH_BRANCHES"
   echo "Pushing $PUSH_BRANCHES"
+  # We know that there are no spaces in any branch within $PUSH_BRANCHES, so
+  # it is safe to use it unquoted.  (This also applies to the other shellcheck
+  # exceptions below.)
+  #
+  # shellcheck disable=SC2086
   git push --atomic "$@" "$UPSTREAM_REMOTE" $PUSH_BRANCHES
   git push --atomic "$@" "$UPSTREAM_REMOTE" $PUSH_BRANCHES
 else
 else
-  PUSH_BRANCHES=`echo "$PUSH_BRANCHES" | tr " " "\n" | sort -V`
-  MASTER_BRANCH=`echo "$PUSH_BRANCHES" | tr " " "\n" | grep master`
-  MAINT_BRANCHES=`echo "$PUSH_BRANCHES" | tr " " "\n" | grep maint`
-  RELEASE_BRANCHES=`echo "$PUSH_BRANCHES" | tr " " "\n" | grep release | \
-    tr "\n" " "`
+  PUSH_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | sort -V)
+  MASTER_BRANCH=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep master)
+  MAINT_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep maint)
+  RELEASE_BRANCHES=$(echo "$PUSH_BRANCHES" | tr " " "\n" | grep release | \
+    tr "\n" " ")
   printf "Pushing with %ss delays, so CI runs in this order:\n%s\n%s\n%s\n" \
   printf "Pushing with %ss delays, so CI runs in this order:\n%s\n%s\n%s\n" \
     "$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES" "$RELEASE_BRANCHES"
     "$PUSH_DELAY" "$MASTER_BRANCH" "$MAINT_BRANCHES" "$RELEASE_BRANCHES"
-  git push "$@" "$UPSTREAM_REMOTE" $MASTER_BRANCH
+  git push "$@" "$UPSTREAM_REMOTE" "$MASTER_BRANCH"
   sleep "$PUSH_DELAY"
   sleep "$PUSH_DELAY"
+  # shellcheck disable=SC2086
   for b in $MAINT_BRANCHES; do
   for b in $MAINT_BRANCHES; do
     git push "$@" "$UPSTREAM_REMOTE" $b
     git push "$@" "$UPSTREAM_REMOTE" $b
     sleep "$PUSH_DELAY"
     sleep "$PUSH_DELAY"
   done
   done
+  # shellcheck disable=SC2086
   git push --atomic "$@" "$UPSTREAM_REMOTE" $RELEASE_BRANCHES
   git push --atomic "$@" "$UPSTREAM_REMOTE" $RELEASE_BRANCHES
 fi
 fi