]> git.nbdom.net Git - nb.git/commitdiff
bin/nb-update
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 3 Jan 2018 18:33:02 +0000 (18:33 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 3 Jan 2018 18:33:02 +0000 (18:33 +0000)
bin/nb-update
etc/profile.d/git.sh

index 769dbf53f3559265398518dc69a77ed44fd04d50..aeb4d95395ddb9af316d14cc9f03041434376388 100755 (executable)
@@ -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"
index d60579dfa2b193e0ca8e1f3b9961059368b1efc9..e2bd7ab172e8602a526ee20092c8d21cd2bbbffa 100644 (file)
@@ -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}'
+}