aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-09-22 20:49:06 -0700
committerEric Biggers <ebiggers@google.com>2023-09-23 10:49:41 -0700
commitdd1590360afe6074b12d9df4a7ea59bc3ff72918 (patch)
treea1f0db49fe3be7b5e27a984a19f68497dcd006df
parente5bc1f22672549f0c6ec7a360b6b660642337aee (diff)
downloadxfstests-bld-dd1590360afe6074b12d9df4a7ea59bc3ff72918.tar.gz
fstests-bld/get-all: replace directories that aren't git repos
When one of the target directories already exists but isn't actually a git repo, the 'get-all' script gets confused and messes with the parent repo "xfstests-bld" by changing the URL of the "origin" remote and checking out a commit. The upcoming change to use external libaio would cause this issue to happen for anyone who has done a build and not cleaned it. Avoid this issue by making 'get-all' automatically replace target directories that exist but aren't git repositories. Signed-off-by: Eric Biggers <ebiggers@google.com>
-rwxr-xr-xfstests-bld/get-all11
1 files changed, 11 insertions, 0 deletions
diff --git a/fstests-bld/get-all b/fstests-bld/get-all
index 1e390d23..82fa2e22 100755
--- a/fstests-bld/get-all
+++ b/fstests-bld/get-all
@@ -69,6 +69,17 @@ setup_repo()
local commit="${!3}"
local required="$4"
+ # If there is a plain directory where the git repo should be, remove it.
+ # This handles the switch from in-tree libaio to external libaio.
+ if [ -d "$repo_name" ] && [ ! -e "$repo_name/.git" ]; then
+ if [ -n "$NO_ACTION" ]; then
+ echo "Replace plain directory '$repo_name' with git repo"
+ return
+ fi
+ echo "Replacing plain directory '$repo_name' with git repo"
+ rm -rf "$repo_name"
+ fi
+
# Clone the repository if needed.
if [ ! -d "$repo_name" ]; then
if [ -z "$repo_url" ]; then