From 9d1f4913c3228f846cfe1eb81e42dc1a2902b29c Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 4 Aug 2014 03:37:46 +0400 Subject: [PATCH] Do something on all located git repositories --- do-all | 11 +++++++++++ gc-not-packed | 8 ++++++++ ls-not-packed | 4 ++++ 3 files changed, 23 insertions(+) create mode 100755 do-all create mode 100755 gc-not-packed create mode 100755 ls-not-packed diff --git a/do-all b/do-all new file mode 100755 index 0000000..2a8e19b --- /dev/null +++ b/do-all @@ -0,0 +1,11 @@ +#! /usr/bin/env bash + +prog_dir="`dirname \"$0\"`" && + +while true; do + read d || exit 0 + if ! test -d "$d"; then continue; fi + test -d "$d"/.git && g="$d"/.git || g="$d" + b="`basename \"$d\" .git`" + eval "$@" +done < "$prog_dir"/locate-all.list diff --git a/gc-not-packed b/gc-not-packed new file mode 100755 index 0000000..c9f7be2 --- /dev/null +++ b/gc-not-packed @@ -0,0 +1,8 @@ +#! /bin/sh + +prog_dir=`dirname "$0"` +for d in `"$prog_dir"/ls-not-packed` +do + echo "----- $d -----" && cd "$d" && + git gc --aggressive && git fsck --strict || exit 1 +done diff --git a/ls-not-packed b/ls-not-packed new file mode 100755 index 0000000..d2bb878 --- /dev/null +++ b/ls-not-packed @@ -0,0 +1,4 @@ +#! /bin/sh + +exec "`dirname \"$0\"`"/do-all \ + 'test "`ls -1 \"$g\"/objects 2>/dev/null | wc -l`" -gt 2 && echo "$d"' -- 2.39.5