cronet import: only clone repository if it doesn't already exist
Otherwise, fetch and checkout the revision.
Test: run import
Change-Id: I11d77e8abfc50fee92f440ad46cb09ab87392e05
diff --git a/Cronet/tools/import/import_cronet.sh b/Cronet/tools/import/import_cronet.sh
index f5545a3..6639a4c 100755
--- a/Cronet/tools/import/import_cronet.sh
+++ b/Cronet/tools/import/import_cronet.sh
@@ -60,8 +60,13 @@
mkdir -p "${COPYBARA_FOLDER_ORIGIN}"
cd "${COPYBARA_FOLDER_ORIGIN}"
- # For this to work _new_rev must be a branch or a tag.
- git clone --depth=1 --branch "${_new_rev}" https://chromium.googlesource.com/chromium/src.git
+ if [ -d src ]; then
+ (cd src && git fetch --tags && git checkout "${_new_rev}")
+ else
+ # For this to work _new_rev must be a branch or a tag.
+ git clone --depth=1 --branch "${_new_rev}" https://chromium.googlesource.com/chromium/src.git
+ fi
+
cat <<EOF >.gclient
solutions = [