From: Oleg Broytman Date: Fri, 17 Apr 2020 15:41:21 +0000 (+0300) Subject: Add `run-bare-repos`: run a command over all bare repositories X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=c0d1785b8a5564edcf3bcd38446ef6d327fd5153;p=git-scripts.git Add `run-bare-repos`: run a command over all bare repositories --- diff --git a/run-bare-repos b/run-bare-repos new file mode 100755 index 0000000..9f667ce --- /dev/null +++ b/run-bare-repos @@ -0,0 +1,18 @@ +#! /bin/sh + +cd "`dirname \"$0\"`" && +prog_dir="`pwd`" && +export prog_dir + +if [ "$1" = "-v" ]; then + verbose=1 + shift +fi + +cat "$prog_dir"/locate-all.list | +while read d; do + if ! test -d "$d"; then echo "No such dir: $d" >&2; continue; fi + if test -d "$d/.git"; then continue; fi # Skip non-bare repos + if [ "$verbose" = 1 ]; then echo "$d"; fi + cd "$d" && "$@" < /dev/tty || exit 1 +done