X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.bin%2Fcvs-import;h=d11ad9fc6404c8f0b8e49bf4bf0e3f62d193b975;hb=853a0c1f76ed7cb7e9bd6619b9e58b38cca1a1f0;hp=f30b22578eafebda40971fa1f7a7d962a063adcf;hpb=ad0ac428e162583d3fe09b65b249c75e1c6c854e;p=home.git
diff --git a/.bin/cvs-import b/.bin/cvs-import
index f30b225..d11ad9f 100755
--- a/.bin/cvs-import
+++ b/.bin/cvs-import
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
if [[ $# -eq 0 ]] || [[ $1 == "-h" ]] ; then
echo "Usage: ${0##*/}
[more dirs]"
exit 1
@@ -13,19 +15,22 @@ fi
dir=$(realpath "${dir}")
echo "Importing ${dir} and kids"
-cd ${dir}/..
-cvs -Q add ${dir##*/}
+cd "${dir}/.."
+cvs -Q add "${dir##*/}"
find_files() {
- find . -mindepth $1 -maxdepth $1 '!' '(' -name 'CVS' -o -wholename '*/CVS/*' ')' -print0
+ local depth=$1
+ shift
+ find . -mindepth ${depth} -maxdepth ${depth} \
+ '!' '(' -name 'CVS' -o -wholename '*/CVS/*' ')' "$@"
}
-cd ${dir}
+cd "${dir}"
i=1
while [[ -n $(find_files ${i}) ]] ; do
echo "Importing at depth ${i}"
- find_files ${i} | xargs -0 cvs -Q add
- ((++i))
+ find_files ${i} -exec cvs -Q add {} +
+ : $(( i += 1 ))
done
echo "Done"