This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/7689
osmo-clean-workspace.sh: make more robust against broken git clones
Change-Id: Ifa70fd75468b3e21b5c9327ea28bc7a4c8cb549d
---
M scripts/osmo-clean-workspace.sh
1 file changed, 25 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/89/7689/1
diff --git a/scripts/osmo-clean-workspace.sh b/scripts/osmo-clean-workspace.sh
index fcbfea8..b67b548 100755
--- a/scripts/osmo-clean-workspace.sh
+++ b/scripts/osmo-clean-workspace.sh
@@ -28,16 +28,37 @@
# Git automatically excludes subdirs that are git clones.
git clean -dxf
+git_clean() {
+ repos="$1"
+ if [ ! -d "$repos" ]; then
+ return
+ fi
+
+ if [ ! -d "$repos/.git" ]; then
+ echo "Not a git clone, removing: $repos"
+ rm -rf "$repos"
+ return
+ fi
+ if ! git -C "$repos" checkout -f HEAD; then
+ echo "Cleaning failed, removing: $repos"
+ rm -rf "$repos"
+ return
+ fi
+ if ! git -C "$repos" clean -dxf; then
+ echo "Cleaning failed, removing: $repos"
+ rm -rf "$repos"
+ return
+ fi
+}
+
# leave the deps checkouts around, to not clone entire git history every time,
# but clean each git of build artifacts.
if [ -d "$deps" ]; then
for dep_dir in "$deps"/* ; do
- git -C "$dep_dir" checkout -f HEAD
- git -C "$dep_dir" clean -dxf
+ git_clean "$dep_dir"
done
fi
if [ -d "layer1-headers" ]; then
- git -C "layer1-headers" checkout -f HEAD
- git -C "layer1-headers" clean -dxf
+ git_clean "layer1-headers"
fi
--
To view, visit https://gerrit.osmocom.org/7689
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa70fd75468b3e21b5c9327ea28bc7a4c8cb549d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>