From: Nicolas Boisselier Date: Mon, 12 Feb 2024 09:46:31 +0000 (+0100) Subject: etc/profile.d/nb.sh X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=4ca298b9b5cafab18484b0a384a93c567eacf1cb;p=nb.git etc/profile.d/nb.sh --- 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