From ec238db2ad495c88c621a0c1c8bb7939f85d0f00 Mon Sep 17 00:00:00 2001 From: "r.c.ladan@gmail.com" Date: Mon, 2 Jun 2014 20:39:42 +0000 Subject: [PATCH] Invoke the bash shell via /usr/bin/env so that these scripts run on operating systems without /bin/bash too. TEST=run "git cl owners" on FreeBSD BUG= Review URL: https://codereview.chromium.org/197213008 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@274320 0039d316-1c4b-4281-b951-d872f2087c98 --- git-cache | 2 +- git-cl | 2 +- git-crsync | 2 +- git-crup | 2 +- git-freeze | 2 +- git-lkgr | 2 +- git-map | 4 ++-- git-map-branches | 2 +- git-mark-merge-base | 2 +- git-nav-downstream | 2 +- git-nav-upstream | 2 +- git-new-branch | 2 +- git-number | 2 +- git-rebase-update | 4 ++-- git-rename-branch | 2 +- git-reparent-branch | 4 ++-- git-runhooks | 2 +- git-squash-branch | 4 ++-- git-thaw | 2 +- git-try | 2 +- git-upstream-diff | 2 +- man/push_to_gs.sh | 2 +- man/src/common_demo_functions.sh | 2 +- man/src/demo_repo.sh | 2 +- man/src/depot_tools_tutorial.demo.walkthrough.sh | 2 +- man/src/git-freeze.demo.1.sh | 2 +- man/src/git-map-branches.demo.1.sh | 2 +- man/src/git-map.demo.1.sh | 2 +- man/src/git-nav-downstream.demo.1.sh | 2 +- man/src/git-nav-upstream.demo.1.sh | 2 +- man/src/git-new-branch.demo.1.sh | 2 +- man/src/git-squash-branch.demo.1.sh | 2 +- man/src/make_docs.sh | 5 ++++- man/src/prep_demo_repo.sh | 2 +- ninja | 2 +- testing_support/gerrit-init.sh | 2 +- tests/abandon.sh | 2 +- tests/basic.sh | 2 +- tests/hooks.sh | 2 +- tests/owners.sh | 2 +- tests/patch.sh | 2 +- tests/post-dcommit-hook-test.sh | 4 ++-- tests/push-basic.sh | 2 +- tests/push-from-logs.sh | 2 +- tests/rename.sh | 2 +- tests/save-description-on-failure.sh | 2 +- tests/submit-from-new-dir.sh | 2 +- tests/submodule-merge-test.sh | 2 +- tests/test-lib.sh | 2 +- tests/upload-local-tracking-branch.sh | 2 +- tests/upload-stale.sh | 2 +- tests/upstream.sh | 2 +- 52 files changed, 60 insertions(+), 57 deletions(-) diff --git a/git-cache b/git-cache index 586ad0220..95eef4ba0 100755 --- a/git-cache +++ b/git-cache @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-cl b/git-cl index 7b17d25be..e2082a43c 100755 --- a/git-cl +++ b/git-cl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-crsync b/git-crsync index 67b7ae770..2be2acd77 100755 --- a/git-crsync +++ b/git-crsync @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash . git-crup diff --git a/git-crup b/git-crup index 56b84c399..3b8cc697b 100755 --- a/git-crup +++ b/git-crup @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-freeze b/git-freeze index 94e1cb660..0187c2eeb 100755 --- a/git-freeze +++ b/git-freeze @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-lkgr b/git-lkgr index ee8c3ede6..c6a222ddb 100755 --- a/git-lkgr +++ b/git-lkgr @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/git-map b/git-map index b3399c000..3e651c7c6 100755 --- a/git-map +++ b/git-map @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -6,4 +6,4 @@ # git_map.py -- a git-command for presenting a graphical view of the git # history. -. $(type -P python_git_runner.sh) | less -R \ No newline at end of file +. $(type -P python_git_runner.sh) | less -R diff --git a/git-map-branches b/git-map-branches index 3abb11d90..b7da01492 100755 --- a/git-map-branches +++ b/git-map-branches @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-mark-merge-base b/git-mark-merge-base index 285e435bf..502d04cac 100755 --- a/git-mark-merge-base +++ b/git-mark-merge-base @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-nav-downstream b/git-nav-downstream index eb7c1f524..7f8a677e3 100755 --- a/git-nav-downstream +++ b/git-nav-downstream @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-nav-upstream b/git-nav-upstream index 98e72100b..bec3eba22 100755 --- a/git-nav-upstream +++ b/git-nav-upstream @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-new-branch b/git-new-branch index e08023cd5..fb56ee88d 100755 --- a/git-new-branch +++ b/git-new-branch @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-number b/git-number index c311df90f..e1d1298c5 100755 --- a/git-number +++ b/git-number @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-rebase-update b/git-rebase-update index 8eaaba3f4..60c16c3fd 100755 --- a/git-rebase-update +++ b/git-rebase-update @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -6,4 +6,4 @@ # git_rebase_update.py -- Update remote sources, and use rebase to update all # branches in this repo. -. $(type -P python_git_runner.sh) \ No newline at end of file +. $(type -P python_git_runner.sh) diff --git a/git-rename-branch b/git-rename-branch index a082ae0d5..8c188849f 100755 --- a/git-rename-branch +++ b/git-rename-branch @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-reparent-branch b/git-reparent-branch index b364e36b6..1fdb1aecf 100755 --- a/git-reparent-branch +++ b/git-reparent-branch @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -7,4 +7,4 @@ # branch. Afterwards, run a `git rebase-update` cycle to ensure that all # branches correctly reflect their parentage. -. $(type -P python_git_runner.sh) \ No newline at end of file +. $(type -P python_git_runner.sh) diff --git a/git-runhooks b/git-runhooks index 35af2eaa4..5bb503e51 100755 --- a/git-runhooks +++ b/git-runhooks @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash while test "$PWD" != "/"; do if test -f "$PWD/src/.gitmodules"; then diff --git a/git-squash-branch b/git-squash-branch index 6f9e79f1d..0fb183252 100755 --- a/git-squash-branch +++ b/git-squash-branch @@ -1,8 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # git_squash_branch.py -- Collapses the current branch to a single commit. -. $(type -P python_git_runner.sh) \ No newline at end of file +. $(type -P python_git_runner.sh) diff --git a/git-thaw b/git-thaw index 7978be284..74716f1ce 100755 --- a/git-thaw +++ b/git-thaw @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-try b/git-try index 68140ed0c..63c7d56fd 100755 --- a/git-try +++ b/git-try @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/git-upstream-diff b/git-upstream-diff index 964a53020..7d44073e9 100755 --- a/git-upstream-diff +++ b/git-upstream-diff @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/man/push_to_gs.sh b/man/push_to_gs.sh index 22c8c2959..00a5fbb36 100755 --- a/man/push_to_gs.sh +++ b/man/push_to_gs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash MY_DIR=$(dirname "$(readlink "$0")") gsutil cp -r -z html -a public-read "$MY_DIR/html" gs://chrome-infra-docs/flat/depot_tools/docs/ diff --git a/man/src/common_demo_functions.sh b/man/src/common_demo_functions.sh index af7c90655..8f85ad1ea 100755 --- a/man/src/common_demo_functions.sh +++ b/man/src/common_demo_functions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash REMOTE=$(pwd)/demo_repo diff --git a/man/src/demo_repo.sh b/man/src/demo_repo.sh index a07a47ee8..25bf4f0b0 100755 --- a/man/src/demo_repo.sh +++ b/man/src/demo_repo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . common_demo_functions.sh diff --git a/man/src/depot_tools_tutorial.demo.walkthrough.sh b/man/src/depot_tools_tutorial.demo.walkthrough.sh index a7efa8198..f5207cce0 100755 --- a/man/src/depot_tools_tutorial.demo.walkthrough.sh +++ b/man/src/depot_tools_tutorial.demo.walkthrough.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash BLANK_DEMO=1 . demo_repo.sh diff --git a/man/src/git-freeze.demo.1.sh b/man/src/git-freeze.demo.1.sh index 397d1836e..82a0f1f75 100755 --- a/man/src/git-freeze.demo.1.sh +++ b/man/src/git-freeze.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh add deleted_file diff --git a/man/src/git-map-branches.demo.1.sh b/man/src/git-map-branches.demo.1.sh index add924996..c7fb70eff 100755 --- a/man/src/git-map-branches.demo.1.sh +++ b/man/src/git-map-branches.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh silent git branch no_upstream HEAD~ diff --git a/man/src/git-map.demo.1.sh b/man/src/git-map.demo.1.sh index 2c46c8940..ec3ee930e 100755 --- a/man/src/git-map.demo.1.sh +++ b/man/src/git-map.demo.1.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh run git map diff --git a/man/src/git-nav-downstream.demo.1.sh b/man/src/git-nav-downstream.demo.1.sh index 2c0f5e526..d6a774348 100755 --- a/man/src/git-nav-downstream.demo.1.sh +++ b/man/src/git-nav-downstream.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh silent git checkout origin/master diff --git a/man/src/git-nav-upstream.demo.1.sh b/man/src/git-nav-upstream.demo.1.sh index 206ed262b..e0296bbb3 100755 --- a/man/src/git-nav-upstream.demo.1.sh +++ b/man/src/git-nav-upstream.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh silent git checkout subfeature diff --git a/man/src/git-new-branch.demo.1.sh b/man/src/git-new-branch.demo.1.sh index 85eef0593..b0ce57fae 100755 --- a/man/src/git-new-branch.demo.1.sh +++ b/man/src/git-new-branch.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh run git map-branches diff --git a/man/src/git-squash-branch.demo.1.sh b/man/src/git-squash-branch.demo.1.sh index 83cbce631..f43d7d64b 100755 --- a/man/src/git-squash-branch.demo.1.sh +++ b/man/src/git-squash-branch.demo.1.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash . demo_repo.sh run git map diff --git a/man/src/make_docs.sh b/man/src/make_docs.sh index d011a6122..73d76e248 100755 --- a/man/src/make_docs.sh +++ b/man/src/make_docs.sh @@ -1,4 +1,7 @@ -#!/bin/bash -e +#!/usr/bin/env bash + +set -e + shopt -s nullglob cd $(dirname "$0") diff --git a/man/src/prep_demo_repo.sh b/man/src/prep_demo_repo.sh index 241097cb9..f267a9fd0 100755 --- a/man/src/prep_demo_repo.sh +++ b/man/src/prep_demo_repo.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash NO_AUTOPREP=True . common_demo_functions.sh diff --git a/ninja b/ninja index 7b76038a1..063c87a46 100755 --- a/ninja +++ b/ninja @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/testing_support/gerrit-init.sh b/testing_support/gerrit-init.sh index 4884a3cb2..2ea723016 100755 --- a/testing_support/gerrit-init.sh +++ b/testing_support/gerrit-init.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/tests/abandon.sh b/tests/abandon.sh index ab33751a6..da4cf7fb0 100755 --- a/tests/abandon.sh +++ b/tests/abandon.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/basic.sh b/tests/basic.sh index e8b3682bb..85dedaee8 100755 --- a/tests/basic.sh +++ b/tests/basic.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/hooks.sh b/tests/hooks.sh index d890ce6e5..d0c9a6f42 100755 --- a/tests/hooks.sh +++ b/tests/hooks.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/owners.sh b/tests/owners.sh index 28dd7c97d..853fcf7f0 100755 --- a/tests/owners.sh +++ b/tests/owners.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/patch.sh b/tests/patch.sh index d9c66120b..22f6c211c 100755 --- a/tests/patch.sh +++ b/tests/patch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/post-dcommit-hook-test.sh b/tests/post-dcommit-hook-test.sh index a047fc1a0..ec4e4d0ec 100755 --- a/tests/post-dcommit-hook-test.sh +++ b/tests/post-dcommit-hook-test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be @@ -16,7 +16,7 @@ setup_gitsvn cd git-svn cat > .git/hooks/post-cl-dcommit << _EOF -#!/bin/bash +#!/usr/bin/env bash git branch -m COMMITTED _EOF chmod +x .git/hooks/post-cl-dcommit diff --git a/tests/push-basic.sh b/tests/push-basic.sh index 18936c1c8..51a74f0cc 100755 --- a/tests/push-basic.sh +++ b/tests/push-basic.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/push-from-logs.sh b/tests/push-from-logs.sh index a81c51383..0fef2a7d2 100755 --- a/tests/push-from-logs.sh +++ b/tests/push-from-logs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/rename.sh b/tests/rename.sh index 03635a25e..b16bea104 100755 --- a/tests/rename.sh +++ b/tests/rename.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/save-description-on-failure.sh b/tests/save-description-on-failure.sh index 6952ac093..35846885a 100755 --- a/tests/save-description-on-failure.sh +++ b/tests/save-description-on-failure.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/submit-from-new-dir.sh b/tests/submit-from-new-dir.sh index ec9f4d526..f04d9dc22 100755 --- a/tests/submit-from-new-dir.sh +++ b/tests/submit-from-new-dir.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/submodule-merge-test.sh b/tests/submodule-merge-test.sh index 31186ae85..8818a2a5c 100755 --- a/tests/submodule-merge-test.sh +++ b/tests/submodule-merge-test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 4c1901065..1e7223d36 100755 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/upload-local-tracking-branch.sh b/tests/upload-local-tracking-branch.sh index b7602d328..0efd6e0e4 100755 --- a/tests/upload-local-tracking-branch.sh +++ b/tests/upload-local-tracking-branch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/upload-stale.sh b/tests/upload-stale.sh index ddc57cc96..72d1ad3fa 100755 --- a/tests/upload-stale.sh +++ b/tests/upload-stale.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be diff --git a/tests/upstream.sh b/tests/upstream.sh index b3ff0acee..8c91ebfe9 100755 --- a/tests/upstream.sh +++ b/tests/upstream.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be