[cogito] Sync objects only when needed...

From: Michal Rokos <michal@rokos.info>
Date: 2005-05-23 17:48:29
Hello,

during the day I'm usually connected via modem so syncing all the objects via rsync is painful.

So, is there any reason to sync them even if remote and and local origin head are the same?

 Michal

PS: I'm off the list, so please CC me.

Signed-off-by: Michal Rokos <michal@rokos.info>

Index: cg-pull
===================================================================
--- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/cg-pull  (mode:100755)
+++ uncommitted/cg-pull  (mode:100755)
@@ -9,8 +9,14 @@
 
 . ${COGITO_LIB}cg-Xlib
 
-name=$1
+force=
 
+if [ "$1" == "-f" ]; then
+ force=1
+ shift
+fi
+
+name=$1
 
 [ "$name" ] || { [ -s $_git/refs/heads/origin ] && name=origin; }
 [ "$name" ] || die "where to pull from?"
@@ -199,6 +205,22 @@
 fi
 [ "$rsyncerr" ] && die "unable to get the head pointer of branch $rembranch"
 
+new_head=$(cat "$_git/refs/heads/$name")
+
+if [ ! "$orig_head" ]; then
+ echo "New branch: $new_head"
+
+elif [ "$orig_head" != "$new_head" ]; then
+ echo "Tree change: $orig_head:$new_head"
+
+elif [ -n "$force" ]; then
+ echo "Update forced..."
+
+else
+ echo "Up to date."
+ exit
+fi
+
 [ -d $_git_objects ] || mkdir -p $_git_objects
 $pull "$name" "$uri" || die "objects pull failed"
 
@@ -215,8 +237,6 @@
 [ "$rsyncerr" ] && echo "unable to get tags list (non-fatal)" >&2
 
 
-new_head=$(cat "$_git/refs/heads/$name")
-
 if [ ! "$orig_head" ]; then
  echo "New branch: $new_head"
 
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon May 23 17:49:01 2005

This archive was generated by hypermail 2.1.8 : 2005-05-23 17:49:01 EST