git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Rokos <michal@rokos.info>
To: git@vger.kernel.org
Subject: [cogito] Sync objects only when needed...
Date: Mon, 23 May 2005 09:48:29 +0200	[thread overview]
Message-ID: <200505230948.29944.michal@rokos.info> (raw)

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"
 

                 reply	other threads:[~2005-05-23  7:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200505230948.29944.michal@rokos.info \
    --to=michal@rokos.info \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).