From b123d3d46c93735c9e4f9a2226b39743e57b5767 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 29 Mar 2019 01:41:18 +0000 Subject: [PATCH] etc/profile.d/nb.sh --- etc/profile.d/nb.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 602ae472..8dad8c9b 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -24,19 +24,20 @@ nb_repos_commit_push() { nb_repos_status() { shell_help "List repos git status" "$@" && return - local status -# NB 26.01.18 local pwd=`pwd` - local i + local status i branch local ret=0 + local sav_pwd=${PWD:-$(pwd)} for i in $(nb_repos); do -# NB 26.01.18 cd "$i" || continue + cd "$i" || continue - status=$(cd "$i" && git status --short "$i"|sed 's/^/ /') || continue + for branch in $(git branch | sed -E 's/^[\* ]+//'); do + status=$(git status --short --branch "$branch"|grep -v '^#'|sed 's/^/ /') || continue [ -n "$status" ] && status=$'\n'"$status" && ret=1 - printf "%s %s\n" "$i" "$status" + printf "%s %s\n" "$i [$branch]" "$status" + done done -# NB 26.01.18 cd "$pwd" + cd "$sav_pwd" return $ret } -- 2.47.3