From: Mike Frysinger Date: Wed, 5 Aug 2015 13:39:20 +0000 (-0400) Subject: cvs-import: modernize a bit X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bb330599709213198ce29587e16a60a06fd09343;p=home.git cvs-import: modernize a bit --- 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"