You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ncdns-repro/tools/cirrus_unpack_git.sh

24 lines
607 B
Bash

#!/usr/bin/env bash
set -euxo pipefail
shopt -s failglob
echo "Initial git cache usage:"
du -h -d1 ./git_clones/
for PROJECT in ./git_index/*
do
PROJECT_BASE="$(basename $PROJECT)"
# It's possible that the cache contains a project that was removed from the
# build sometime after the cache was saved. In such a case, unpacking it
# would result in "No such file or directory", so we just discard it
# instead.
if [[ -d "./git_clones/${PROJECT_BASE}/.git" ]]
then
mv "${PROJECT}" "./git_clones/${PROJECT_BASE}/.git/index"
else
rm "${PROJECT}"
fi
done