From 9f53e1f6aaa1b935e1e552cf206e327682de7dde Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 14 Aug 2016 23:36:28 +0200 Subject: list_repo_dirs: bugfix If there was a dir within a repo with a few other dirs in it (and no files), that top-level directory wouldn't come up in list_repo_dirs's output. --- .bashrc_git | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.bashrc_git b/.bashrc_git index 276b643..54e50f6 100644 --- a/.bashrc_git +++ b/.bashrc_git @@ -35,12 +35,12 @@ list_repo_files() ( list_repo_dirs() ( set -o errexit -o nounset -o pipefail - local terminator='\n' + local -a cmd=(git ls-tree -d -r) while [ "$#" -gt 0 ]; do case "$1" in -z|-0) - terminator='\000' + cmd+=(-z) shift ;; @@ -56,11 +56,9 @@ list_repo_dirs() ( esac done - { printf '.\0' ; list_repo_files -z ; } \ - | xargs -0 dirname -z \ - | sort -uz \ - | tail -z -n +2 \ - | tr '\000' "$terminator" + cmd+=(--name-only HEAD) + + eval "${cmd[@]+"${cmd[@]}"}" ) tighten_repo_security() ( -- cgit v1.2.3