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
This commit is contained in:
k0kubun 2018-07-08 05:52:12 +00:00
Родитель c2ae11e308
Коммит a1e589498d
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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"