Commit 83f916f6 authored by Damyan Ivanov's avatar Damyan Ivanov

gc: support parallel from both GNU moreutils

parent e4cd2510
......@@ -82,7 +82,7 @@ Suggests: bc,
cdbs,
duck,
moreutils,
parallel,
parallel | moreutils,
perl-depends,
python,
python-launchpadlib
......
......@@ -27,9 +27,13 @@ while getopts vshp opt; do
;;
p)
if which parallel > /dev/null ; then
PARALLEL=1
if parallel --will-cite < /dev/null > /dev/null; then
PARALLEL=GNU
else
PARALLEL="moreutils"
else
echo "W: 'parallel' not available, wil run sequentially" >&2
echo "W: 'parallel' not available, will run sequentially" >&2
echo "W: you may want to install 'parallel' or 'moreutils'" >&2
fi
;;
v) VERBOSE=1;;
......@@ -78,8 +82,13 @@ if [ -n "$STATS" ]; then
fi
if [ -n "$PARALLEL" ]; then
find . -maxdepth 2 -type d -name .git | \
parallel --will-cite sh -c "GIT_DIR='{}' git gc --quiet"
if [ "$PARALLEL" = "GNU" ]; then
find . -maxdepth 2 -type d -name .git | \
parallel --will-cite sh -c "GIT_DIR='{}' git gc --quiet"
else
find . -maxdepth 2 -type d -name .git -print0 | \
xargs -r0 parallel -i sh -c "GIT_DIR='{}' git gc --quiet" --
fi
else
for d in `find . -maxdepth 1 -type d`; do
[ -d "$d/.git" ] || continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment