[PATCH 2/4] git-shell-commands: Add a command to list bare repos
Signed-off-by: Greg Brockman <gdb@mit.edu>
---
contrib/git-shell-commands/list | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
create mode 100755 contrib/git-shell-commands/list
diff --git a/contrib/git-shell-commands/list b/contrib/git-shell-commands/list
new file mode 100755
index 0000000..cd8b15a
--- /dev/null
+++ b/contrib/git-shell-commands/list
@@ -0,0 +1,5 @@
+#!/bin/sh
+set -eu
+
+print_if_bare_repo='[ "$(git --git-dir="$1" rev-parse --is-bare-repository)" = true ] && echo "${1#./}"'
+find -type d -name "*.git" -exec sh -c "$print_if_bare_repo" -- \{} \; -prune
--
1.7.0.4