aboutsummaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-13 08:08:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-13 08:08:04 +0000
commitb92a58be836f5e9fb72e8cc494181de38631ecbc (patch)
tree2841aa776c40ce54cc68f291f04cc121006c4513 /tool
parent67ba7ad3e69b75ff21d744a595074883493dbdc7 (diff)
downloadruby-b92a58be836f5e9fb72e8cc494181de38631ecbc.tar.gz
git-refresh: for symlink srcdir
* tool/git-refresh: use `cd -P` for symlink srcdir. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/git-refresh14
1 files changed, 10 insertions, 4 deletions
diff --git a/tool/git-refresh b/tool/git-refresh
index 88ed70f757..2f41ba1b9d 100755
--- a/tool/git-refresh
+++ b/tool/git-refresh
@@ -1,15 +1,21 @@
#!/bin/sh
set -e
+if cd -P . 2>/dev/null; then
+ CHDIR='cd -P'
+else
+ CHDIR='cd'
+fi
+
quiet=
branch=
until [ $# = 0 ]; do
case "$1" in
--) shift; break;;
- -C|--directory) shift; cd "$1";;
- -C*) cd `expr "$1" : '-C\(.*\)'`;;
- --directory=*) cd `expr "$1" : '[^=]*=\(.*\)'`;;
+ -C|--directory) shift; $CHDIR "$1";;
+ -C*) $CHDIR `expr "$1" : '-C\(.*\)'`;;
+ --directory=*) $CHDIR `expr "$1" : '[^=]*=\(.*\)'`;;
-q) quiet=1;;
-b|--branch) shift; branch="$1";;
-b*) branch=`expr "$1" : '-b\(.*\)'`;;
@@ -26,7 +32,7 @@ shift 2
if [ -d "$dir" ]; then
echo updating `expr "/$dir/" : '.*/\([^/][^/]*\)/'` ...
[ $quiet ] || set -x
- cd "$dir"
+ $CHDIR "$dir"
git fetch "$@"
exec git checkout ${branch:+"$branch"} "$@"
else