From 4ca298b9b5cafab18484b0a384a93c567eacf1cb Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 12 Feb 2024 10:46:31 +0100 Subject: [PATCH] etc/profile.d/nb.sh --- etc/profile.d/nb.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 33d76749..86d43256 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -27,16 +27,15 @@ nb_repos_status() { for i in ${@:-$(nb_repos)}; do cd "$i" || continue - local branch_orig=$(git branch | awk '/^\*/{print $2}') - [ -z "$branch_orig" ] && continue - local u=$( ls -1dl "$i" | awk '{print $3}' ) if [ "$u" != "$USER" ]; then - #echo "$i [WRONG OWNER]" - printf "%s %s\n" "$i [$branch_orig]" "WRONG OWNER" + printf "%s %s\n" "$i" "WRONG OWNER" continue fi + local branch_orig=$(git branch | awk '/^\*/{print $2}') + [ -z "$branch_orig" ] && continue + for branch in $(git branch | sed -E 's/^[\* ]+//'); do git checkout --quiet "$branch" 2>/dev/null || continue -- 2.47.3