about summary refs log tree commit diff
path: root/src/ci
diff options
context:
space:
mode:
authorAidan Hobson Sayers <aidanhs@cantab.net>2017-04-04 22:51:16 +0100
committerAidan Hobson Sayers <aidanhs@cantab.net>2017-04-04 23:41:38 +0100
commitb970bc2a79719b5c1573fb87c96773ce131dbb8d (patch)
tree804e1a1fb9493a6bc68dd2989d7836127499a71a /src/ci
parent2564711e803f62e04bebf10408cc1c11297c0caf (diff)
downloadrust-b970bc2a79719b5c1573fb87c96773ce131dbb8d.tar.gz
rust-b970bc2a79719b5c1573fb87c96773ce131dbb8d.zip
Enable appveyor cache, add more paranoia
Diffstat (limited to 'src/ci')
-rwxr-xr-xsrc/ci/init_repo.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh
index 4e22907d979..c235681cddd 100755
--- a/src/ci/init_repo.sh
+++ b/src/ci/init_repo.sh
@@ -38,9 +38,20 @@ fi
 
 # Wipe the cache if it's not valid, or mark it as invalid while we update it
 if [ ! -f "$cache_valid_file" ]; then
-    rm -rf "$CACHE_DIR" && mkdir "$CACHE_DIR"
+    rm -rf "$CACHE_DIR"
+    mkdir "$CACHE_DIR"
 else
-    rm "$cache_valid_file"
+    stat_lines=$(cd "$cache_src_dir" && git status --porcelain | wc -l)
+    stat_ec=$(cd "$cache_src_dir" && git status >/dev/null 2>&1 && echo $?)
+    if [ ! -d "$cache_src_dir/.git" -o $stat_lines != 0 -o $stat_ec != 0 ]; then
+        # Something is badly wrong - the cache valid file is here, but something
+        # about the git repo is fishy. Nuke it all, just in case
+        echo "WARNING: $cache_valid_file exists but bad repo: l:$stat_lines, ec:$stat_ec"
+        rm -rf "$CACHE_DIR"
+        mkdir "$CACHE_DIR"
+    else
+        rm "$cache_valid_file"
+    fi
 fi
 
 # Update the cache (a pristine copy of the rust source master)