summaryrefslogtreecommitdiff
path: root/config/services/git/shell-commands/repo/src/show_command.sh
blob: 77bb92fbc9421bb680696e8961e908a72aa10b3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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