summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-08-31 16:56:44 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-08-31 16:56:44 +0000
commit03e5e2ec7bb876fa5781d90f6dd0666b054483ec (patch)
treeac39bb2d9d479968a059d8bd695285a44c637cc9
parent33488ecffa86c868935b7e3c46f6f9ff5fa459f8 (diff)
jenkins-helpers.sh: Also reduce size of base-artifacts repos
Change-Id: I12e987230359c417ee8a5090065f3025bc6218e6
-rw-r--r--jenkins-helpers.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 771ef037..26151090 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -481,14 +481,14 @@ clone_or_update_repo_no_checkout ()
rm -rf "$dir"
fi
- if [ -d "$dir" ] && [ x"$refopt" != x"" ] \
- && [ "$(du -s "$dir/.git" | cut -f 1)" -gt $((1024*1024)) ]; then
- # Current clone has grown above 1GB, and we have a reference repo,
- # which should cut down the size significantly.
- # Redo the clone to save disk space.
- # PS: Unfortunately, I could not find a way to make the current clone
- # use new objects from the reference repo without a full re-clone.
- # Fortunately, a new clone with a reference repo is quick.
+ if [ -d "$dir" ] \
+ && [ "$(du -s "$dir/.git" | cut -f 1)" -gt $((1024*1024)) ] \
+ && { [ x"$refopt" != x"" ] || [ x"$single_branch" != x"" ]; }; then
+ # Current clone has grown above 1GB, and we have a reference repo
+ # (which should cut down the size significantly) or we are asked
+ # to clone a single branch (which usually means that cloning all
+ # branches is expensive -- this is for base-artifacts repo, mostly).
+ # We redo the clone to save disk space.
rm -rf "$dir"
fi