From 9f9aba13b96c15a989ff41b448106419f343654b Mon Sep 17 00:00:00 2001 From: "newt@chromium.org" Date: Mon, 26 Nov 2012 17:51:15 +0000 Subject: [PATCH] Fix usage of bash builtin "local" in update_depot_tools. The bash command "local myvar=$(mycommand)" has the exit status of the bash builtin "local" rather than the exit status of mycommand. To get the exit status of mycommand, "local myvar" should be run separately on a previous line. Review URL: https://chromiumcodereview.appspot.com/11308129 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@169446 0039d316-1c4b-4281-b951-d872f2087c98 --- update_depot_tools | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/update_depot_tools b/update_depot_tools index dc58e5211..3ad917a8f 100755 --- a/update_depot_tools +++ b/update_depot_tools @@ -34,7 +34,8 @@ fi # Test git and git --version. function test_git { - local GITV="$("$GIT" --version)" || { + local GITV + GITV="$("$GIT" --version)" || { echo "git isn't installed, please install it" exit 1 } @@ -49,7 +50,8 @@ function test_git { # Test git svn and git svn --version. function test_git_svn { - local GITV="$("$GIT" svn --version)" || { + local GITV + GITV="$("$GIT" svn --version)" || { echo "git-svn isn't installed, please install it" exit 1 } @@ -70,9 +72,10 @@ function is_git_clone_repo { function update_git_repo { if is_git_clone_repo; then git fetch -q origin &> /dev/null - local REBASE_TXT=$(git rebase -q origin/master 2>&1) - local STATUS=$? - if [[ $STATUS != 0 ]]; then + local REBASE_TXT STATUS + REBASE_TXT=$(git rebase -q origin/master 2>&1) + STATUS=$? + if [[ $STATUS -ne 0 ]]; then echo "depot_tools update failed. Conflict in $base_dir" >&2 echo "$REBASE_TXT" >&2 git rebase --abort 2> /dev/null