aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 23:36:28 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-14 23:36:28 +0200
commit9f53e1f6aaa1b935e1e552cf206e327682de7dde (patch)
treec01ddc5921b68bc4ec05672b91aab71d0da652cd
parent.vimrc: add directories for backup/swap files (diff)
downloadlinux-home-9f53e1f6aaa1b935e1e552cf206e327682de7dde.tar.gz
linux-home-9f53e1f6aaa1b935e1e552cf206e327682de7dde.zip
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.
Diffstat (limited to '')
-rw-r--r--.bashrc_git12
1 files 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() (