]> gitweb.fluxo.info Git - utils-git.git/commitdiff
Auto fetch changes on commit, fix staging check
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 14 May 2017 17:26:09 +0000 (14:26 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 14 May 2017 17:26:09 +0000 (14:26 -0300)
commit
commit-updates

diff --git a/commit b/commit
index ccf03f62af66355bdd54b9dacb8c4fd2ad128a2e..e7026b6db7c6359c75d4d223b9cceb86c33fce35 100755 (executable)
--- a/commit
+++ b/commit
@@ -131,6 +131,8 @@ function git_commit {
   # If there are no staged files, commit everything.
   # Otherwise commit just what was staged
   if git status --short | grep -q "^[AM]"; then
+    flag=""
+  else
     flag="-a"
   fi
 
@@ -148,5 +150,6 @@ if [ ! -z "$1" ]; then
     git_user
     git_commit $*
     git_push
+    git fetch --all
   fi
 fi
index b0333481d8dfc501fdb0cb12cfe4dee763b472a9..082727d1c06cdefe9aac38252207d943764c3d3f 100755 (executable)
@@ -13,11 +13,9 @@ if git status &> /dev/null; then
   else
     commit "Updates $(basename `pwd`)"
   fi
-
-  git fetch --all
 else
   if [ ! -z "$1" ] && [ -d "$1" ]; then
-    ( cd $1 &> /dev/null && commit "Updates $(basename $1)" && git fetch --all )
+    ( cd $1 &> /dev/null && commit "Updates $(basename $1)" )
   else
     mr commit -m "Updates"
     mr fetch