aboutsummaryrefslogtreecommitdiffstats
path: root/tool/git-refresh
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 05:52:12 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-08 05:52:12 +0000
commita1e589498d1b80e3bc8b3e8c5c07874afcf0cb17 (patch)
tree616e21175cf978420c215ce39940c5b47f62c108 /tool/git-refresh
parentc2ae11e308c4339803d78308959ee4a15af0e659 (diff)
downloadruby-a1e589498d1b80e3bc8b3e8c5c07874afcf0cb17.tar.gz
tool/git-refresh: skip git fetch and checkout
if the tag is already checked out, to optimize the execution time. I'm going to prepare a task depending on this tool, and I want that to finish fast and output nothing when it's already up-to-date. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/git-refresh')
-rwxr-xr-xtool/git-refresh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tool/git-refresh b/tool/git-refresh
index d36c4d80bc..9ed7d7c76e 100755
--- a/tool/git-refresh
+++ b/tool/git-refresh
@@ -31,6 +31,9 @@ dir="$2"
shift 2
[ x"$branch" = x ] && unset branch || :
if [ -d "$dir" ]; then
+ if [ x"$(git -C "$dir" describe --tags)" = x"$branch" ]; then
+ exit 0 # already up-to-date
+ fi
echo updating `expr "/$dir/" : '.*/\([^/][^/]*\)/'` ...
[ $quiet ] || set -x
$CHDIR "$dir"