From 35dfb8f47b8ca80b533459ea81acdae70a12e75d Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 3 Jan 2018 18:33:02 +0000 Subject: [PATCH] bin/nb-update --- bin/nb-update | 6 ++++-- etc/profile.d/git.sh | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bin/nb-update b/bin/nb-update index 769dbf53..aeb4d953 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -33,7 +33,9 @@ for repo in $(nb_repos); do [ -d "$repo/.git" ] || continue cd "$repo" || continue - name="$(basename $repo)" + name=$(git_name) || continue + [ -z "$name" ] && continue + #name="$(basename $repo)" # # Get user @@ -52,7 +54,7 @@ for repo in $(nb_repos); do # # Pull # - echo ">git pull $repo (user=$user)" + echo ">Pull $name branch=$(git_branch) user=$user path=$repo" cmd="${cmd}GIT_SSH=$GIT_SSH cd \"$repo\" && git pull" [ "$CLEANUP" = "1" ] && cmd="$cmd && git gc" diff --git a/etc/profile.d/git.sh b/etc/profile.d/git.sh index d60579df..e2bd7ab1 100644 --- a/etc/profile.d/git.sh +++ b/etc/profile.d/git.sh @@ -138,6 +138,11 @@ git_list() { _git_conn_check="" git_conn_check() { #local dest=$(git config --local --get remote.origin.url | sed -e 's/:.*$//' -e 's/^.*@//') + if [ "$1" = "-reset" ]; then + _git_conn_check="" + return + fi + local dest=$(git config --local --get remote.origin.url) local port='' @@ -192,3 +197,11 @@ git_merge_to() { git_branch_create_push() { git checkout -b "$1" && git push --set-upstream origin "$1" } + +git_name() { + git config --local remote.origin.url|sed 's,^.*[:/]\([^:/\.]\+\)\(\.git\)\?$,\1,' +} + +git_branch() { + git branch | awk '/^\*/{print $2}' +} -- 2.47.3