]> git.phdru.name Git - git-scripts.git/commitdiff
Do something on all located git repositories
authorOleg Broytman <phd@phdru.name>
Sun, 3 Aug 2014 23:37:46 +0000 (03:37 +0400)
committerOleg Broytman <phd@phdru.name>
Sun, 3 Aug 2014 23:37:46 +0000 (03:37 +0400)
do-all [new file with mode: 0755]
gc-not-packed [new file with mode: 0755]
ls-not-packed [new file with mode: 0755]

diff --git a/do-all b/do-all
new file mode 100755 (executable)
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 (executable)
index 0000000..c9f7be2
--- /dev/null
@@ -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 (executable)
index 0000000..d2bb878
--- /dev/null
@@ -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"'