commit aee18f7112fdc91fc64034e3b156c9dbaae094a5
parent d443e9b31bc499a3bed44a5ae3a6a2b9e0ac8f95
Author: Adham Zahran <lordadamson@gmail.com>
Date: Wed, 13 Sep 2017 13:27:53 +0200
parent d443e9b31bc499a3bed44a5ae3a6a2b9e0ac8f95
Author: Adham Zahran <lordadamson@gmail.com>
Date: Wed, 13 Sep 2017 13:27:53 +0200
does not output errors when no git repos are available
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/git-summary b/git-summary @@ -144,7 +144,16 @@ repo_branch () { # Given a path to a folder containing some git repos, compute the # names of the folders which actually do contain git repos. list_repos () { - find $1 -maxdepth 2 -type 'd' -name ".git" -print0 | xargs -0 -L1 dirname -z | xargs -0 -L1 basename + git_directories=() + while IFS= read -r -d $'\0'; do + git_directories+=("$REPLY") + done < <(find $1 -maxdepth 2 -type 'd' -name ".git" -print0) + + for i in ${git_directories[*]}; do + if [[ ! -z $i ]]; then + dirname -z $i | xargs -0 -L1 basename + fi + done }
: nply/git-summary