mirror of
https://github.com/standardebooks/web.git
synced 2025-07-14 02:21:55 -04:00
Handle repositories with names bigger than 100 chars correctly.
This commit is contained in:
parent
46fe654fac
commit
67f5fe8b27
1 changed files with 23 additions and 2 deletions
|
@ -163,6 +163,14 @@ printf "%s\n" "${repoUrls}" | while IFS= read -r repoUrl; do
|
||||||
[ -n "${repoUrl}" ] || continue
|
[ -n "${repoUrl}" ] || continue
|
||||||
[ -d "${repoUrl##*/}" ] && continue
|
[ -d "${repoUrl##*/}" ] && continue
|
||||||
|
|
||||||
|
repoName="${repoUrl##*/}"
|
||||||
|
repoNameLength=$(printf "%s" "${repoName}" | wc -m)
|
||||||
|
if [ "${repoNameLength}" -ge 100 ]; then
|
||||||
|
if dirs=( "${repoName%%.git}"*/ ) && [[ -d ${dirs[0]} ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${verbosity}" -gt 0 ]; then
|
if [ "${verbosity}" -gt 0 ]; then
|
||||||
printf "Cloning %s ... \n" "${repoUrl}"
|
printf "Cloning %s ... \n" "${repoUrl}"
|
||||||
fi
|
fi
|
||||||
|
@ -173,9 +181,22 @@ printf "%s\n" "${repoUrls}" | while IFS= read -r repoUrl; do
|
||||||
git clone -v --bare "${repoUrl}"
|
git clone -v --bare "${repoUrl}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -d "${repoUrl##*/}" ]; then
|
if ! [ -d "${repoName}" ]; then
|
||||||
printf "Failed to clone %s.\n" "${repoUrl##*/}." 1>&2
|
printf "Failed to clone %s.\n" "${repoName}." 1>&2
|
||||||
elif [ "${verbosity}" -gt 0 ]; then
|
elif [ "${verbosity}" -gt 0 ]; then
|
||||||
printf "Done.\n"
|
printf "Done.\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
properName="$(git -C "${repoName}" show HEAD:src/epub/content.opf |
|
||||||
|
grep -oE "<dc:identifier id=\"uid\">url:https://standardebooks.org/ebooks/[^<]+<\/dc:identifier>" |
|
||||||
|
sed -E "s/<[^>]+?>//g" |
|
||||||
|
sed -E "s|url:https://standardebooks.org/ebooks/||g" |
|
||||||
|
sed -E "s|/|_|g").git"
|
||||||
|
|
||||||
|
if [ "${repoUrl##*/}" != "${properName}" ]; then
|
||||||
|
if [ "${verbosity}" -gt 0 ]; then
|
||||||
|
printf "Moving %s to %s\n" "${repoName}" "${properName}"
|
||||||
|
fi
|
||||||
|
mv "${repoName}" "${properName}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue