mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-23 15:46:19 +00:00
Mercurial branches remain in source-listing and cleanup helpers after Subversion support was retired. SCST development now uses Git. Remove Mercurial detection and commands together with stale Subversion wording. Preserve the existing no-VCS source-list fallback and all Git behavior.
52 lines
904 B
Bash
Executable File
52 lines
904 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
shopt -s nullglob
|
|
|
|
usage() {
|
|
echo "Usage: $(basename "$0") [ -x <exclude> ]*"
|
|
exit 1
|
|
}
|
|
|
|
remove_empty_directories() {
|
|
find . -depth -type d |
|
|
sed 's|^\./||' |
|
|
grep -Ev '^\.$|^\.git/|^\.git$' |
|
|
while read -r d; do
|
|
for f in "$d"/{*,.*}; do
|
|
if ! [ -e "$f" ]; then
|
|
rmdir "$d"
|
|
fi
|
|
break
|
|
done
|
|
done
|
|
}
|
|
|
|
git_options=(-e TAGS)
|
|
|
|
while [ "${1#-}" != "$1" ]; do
|
|
case "$1" in
|
|
-x)
|
|
git_options+=(-e "$2")
|
|
shift; shift;;
|
|
*)
|
|
usage;;
|
|
esac
|
|
done
|
|
|
|
for d in "${@-.}"; do
|
|
(
|
|
if cd "$d"; then
|
|
if [ -e .git ] || [ -e ../.git ]; then
|
|
if ! type -p git >&/dev/null; then
|
|
echo "$0: git: not found."
|
|
exit 0
|
|
fi
|
|
git clean -f -d -x "${git_options[@]}" >/dev/null
|
|
remove_empty_directories
|
|
else
|
|
echo "$0: $d: not administered by Git."
|
|
fi
|
|
fi
|
|
)
|
|
done
|