mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
![nobu](/assets/img/avatar_default.png)
* tool/git-refresh: parse options without git-rev-parse, which is old on travis. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
36 lines
664 B
Bash
Executable file
36 lines
664 B
Bash
Executable file
#!/bin/sh
|
|
set -e
|
|
|
|
quiet=
|
|
branch=
|
|
|
|
until [ $# = 0 ]; do
|
|
case "$1" in
|
|
--) shift; break;;
|
|
-C|--directory) shift; cd "$1";;
|
|
-C*) cd "${1#-C}";;
|
|
--directory=*) cd "${1#*=}";;
|
|
-q) quiet=1;;
|
|
-b|--branch) shift; branch="$1";;
|
|
-b*) branch="${1#-b}";;
|
|
--branch=*) branch="${1#*=}";;
|
|
-*) echo "unknown option: $1" 1>&2; exit 1;;
|
|
*) break;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
url="$1"
|
|
dir="$2"
|
|
shift 2
|
|
if [ -d "$dir" ]; then
|
|
echo updating "${dir#*/}" ...
|
|
[ $quiet ] || set -x
|
|
cd "$dir"
|
|
git fetch "$@"
|
|
exec git checkout ${branch:+"$branch"} "$@"
|
|
else
|
|
echo retrieving "${dir#*/}" ...
|
|
[ $quiet ] || set -x
|
|
exec git clone "$url" "$dir" "$@"
|
|
fi
|