Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Unified Diff: update_depot_tools

Issue 166273024: More fixes for hardcoded git directory paths. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Use eval to execute GIT var Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: update_depot_tools
===================================================================
--- update_depot_tools (revision 252299)
+++ update_depot_tools (working copy)
@@ -11,10 +11,18 @@
exit
fi
-base_dir=$(dirname "$0")
-if [ -L "$base_dir" ]
-then
+# Test if this script is running under a MSys install. If it is, we will
+# hardcode the paths to SVN and Git where possible.
+OUTPUT="$(uname | grep 'MINGW')"
+MINGW=$?
+
+if [ $MINGW = 0 ]; then
+ base_dir="${0%\\*}"
iannucci 2014/02/21 08:25:07 TIL: bash variable expansion is freaking nuts :(
+else
+ base_dir=$(dirname "$0")
+ if [ -L "$base_dir" ]; then
base_dir=`cd "$base_dir" && pwd -P`
+ fi
fi
# Don't try to use Cygwin tools. Get real win32 tools using the batch script.
@@ -24,11 +32,6 @@
cmd /c `cygpath -w "$base_dir/bootstrap/win/win_tools.bat"` force
fi
-# Test if this script is running under a MSys install. If it is, we will
-# hardcode the paths to SVN and Git where possible.
-OUTPUT="$(uname | grep 'MINGW')"
-MINGW=$?
-
CANONICAL_GIT_URL="https://chromium.googlesource.com/chromium/tools/depot_tools.git"
SVN="svn"
@@ -37,14 +40,14 @@
fi
GIT="git"
-if [ -d "$base_dir/git-1.8.0_bin" -a $MINGW = 0 ]; then
- GIT="$base_dir/git-1.8.0_bin/bin/git.exe"
+if [ -e "$base_dir/git.bat" -a $MINGW = 0 ]; then
+ GIT="cmd.exe //c \"$base_dir\\git.bat\""
fi
# Test git and git --version.
function test_git {
local GITV
- GITV="$("$GIT" --version)" || {
+ GITV="$(eval "$GIT" --version)" || {
echo "git isn't installed, please install it"
exit 1
}
@@ -60,7 +63,7 @@
# Test git svn and git svn --version.
function test_git_svn {
local GITV
- GITV="$("$GIT" svn --version)" || {
+ GITV="$(eval "$GIT" svn --version)" || {
echo "git-svn isn't installed, please install it"
exit 1
}
@@ -75,11 +78,11 @@
}
function is_git_clone_repo {
- "$GIT" config remote.origin.fetch > /dev/null
+ eval "$GIT" config remote.origin.fetch > /dev/null
}
function update_git_repo {
- remote_url=$("$GIT" config --get remote.origin.url)
+ remote_url=$(eval "$GIT" config --get remote.origin.url)
if [ -n "$remote_url" -a "$remote_url" != "$CANONICAL_GIT_URL" ]; then
echo "Your copy of depot_tools is configured to fetch from an obsolete URL:"
echo
@@ -91,7 +94,7 @@
if [[ $STATUS -ne 0 ]]; then
echo "Timeout; not updating remote URL."
elif [ -z "$REPLY" -o "$REPLY" = "Y" -o "$REPLY" = "y" ]; then
- "$GIT" config remote.origin.url "$CANONICAL_GIT_URL"
+ eval "$GIT" config remote.origin.url "$CANONICAL_GIT_URL"
echo "Remote URL updated."
fi
fi
@@ -111,7 +114,7 @@
test_git_svn
# work around a git-svn --quiet bug
- OUTPUT=`"$GIT" svn rebase -q -q`
+ OUTPUT=`eval "$GIT" svn rebase -q -q`
if [[ ! "$OUTPUT" == *Current.branch* ]]; then
echo $OUTPUT 1>&2
fi
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698