summaryrefslogtreecommitdiff
path: root/config/services/git/shell-commands/repo/src/show_command.sh
diff options
context:
space:
mode:
Diffstat (limited to 'config/services/git/shell-commands/repo/src/show_command.sh')
-rw-r--r--config/services/git/shell-commands/repo/src/show_command.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/config/services/git/shell-commands/repo/src/show_command.sh b/config/services/git/shell-commands/repo/src/show_command.sh
new file mode 100644
index 0000000..77bb92f
--- /dev/null
+++ b/config/services/git/shell-commands/repo/src/show_command.sh
@@ -0,0 +1,35 @@
+if [[ -z "${args[path]}" ]]
+then
+ path=/srv/git/
+else
+ path=$(realpath "${args[path]}")
+ check-realpath "$path"
+fi
+
+if [[ $(is-git-dir "$path") ]]
+then
+ args[--verbose]=1
+fi
+
+dirs=$(find "$path" -type f -name HEAD | while read -r head; do
+ dir="${head%/*}"
+ if [[ "${args[--tree]}" ]]
+ then
+ while [[ "$dir" != "/srv/git" && -n "$dir" ]]; do
+ echo "$dir/"
+ dir="${dir%/*}"
+ done
+ else
+ echo "$dir/"
+ fi
+ done | sort -u)
+
+for dir in $dirs
+do
+ if [[ "${args[--verbose]}" ]] && [[ $(is-git-dir "$dir") ]]
+ then
+ show-repo "$dir"
+ else
+ show-repo-summary "$dir"
+ fi
+done