git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brian Foster <brian.foster@innova-card.com>
To: Tomas Carnecky <tom@dbservice.com>
Cc: git@vger.kernel.org
Subject: Re: [SOLVED] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?
Date: Thu, 12 Aug 2010 15:22:54 +0200	[thread overview]
Message-ID: <201008121522.55020.brian.foster@innova-card.com> (raw)
In-Reply-To: <4C63E9E9.7070105@dbservice.com>

On Thursday 12 August 2010 14:32:41 Tomas Carnecky wrote:
> On 8/12/10 2:16 PM, Brian Foster wrote:
> >[ ... ]  This _does_ work:
> > 
> >     git reset --soft FETCH_HEAD
> >[ ... ] 
> >  Given that git-reset(1)'s purpose is to change the branch's
> >  head (or to change HEAD as I've been incorrectly describing
> >  it), that does make sense.
> 
> I expected git checkout to work even in a bare repo - as you can
> see I don't work that often inside bare repos :).

 <<<giggles>>>  No problem!  (I don't either, this situation was
 unexpected, but as SLAVE lagging behind ORIG is anticipated as
 being the usual case, we need to understand it.)

> You should use update-ref instead of reset. The problem with reset is
> that it changes the branch and not HEAD. Say initially your mirror had
> HEAD as symref pointing to refs/heads/master.

 Correct, it does.

>                                               When you run reset --soft
> v2 your master branch will now point to the same commit as the tag v2
> (and HEAD will be still pointing to refs/heads/master).

 Correct, that is what happens.  It also looks Ok to me,
 nor have any tests hit any snags.  It also happens to
 match how we (eventually) manually repaired SLAVE.

>                                                         When you use
> 'git update-ref --no-deref HEAD v2' it will modify HEAD

 NO, it gets an error (following is from a modified version
 of my previously-posted script):
────────────────────────────────────────────────────────
 ...
+ cd ../SLAVE.git                                           
+ git fetch --verbose origin tag v2                         
 ...
From /work/tmp/git/ORIG                      
 * [new tag]         v2         -> v2        
+ git update-ref --no-deref HEAD v2          
error: Trying to write non-commit object 2bc324e6a68cb3704448c9f63ddc3bc0260c0b48 to branch HEAD                                                                                
fatal: Cannot update the ref 'HEAD'.                                                    
$ 
────────────────────────────────────────────────────────

 Using ‘git update-ref --no-deref HEAD FETCH_HEAD’ does
 not error, and, as you say (below), does seem to give
 me a detached head.

> 'git update-ref --no-deref HEAD v2' it will modify HEAD directly and
> have it point directly to the same commit as v2 (also called detached HEAD).

 I do_not_ want a detached head!  This has perhaps been
 confused by my improperly saying “update HEAD” when I
 meant “update the master branch”.  If you look back at
 my originally-posted diagrams, it's a reasonable guess
 I don't want a detached head.  Having HEAD continue to
 be a symref to refs/heads/master (which, in this case,
 is the same commit as v2) is correct.

 Thanks for your help, advice, and hints.
cheers!
	-blf-

  reply	other threads:[~2010-08-12 13:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12  7:54 [Q] `git fetch tag NAME' into mirror repo does not update HEAD, what to do? Brian Foster
2010-08-12  8:33 ` Tomas Carnecky
2010-08-12 10:38   ` Brian Foster
2010-08-12 11:05     ` Tomas Carnecky
2010-08-12 12:16       ` [SOLVED] " Brian Foster
2010-08-12 12:32         ` Tomas Carnecky
2010-08-12 13:22           ` Brian Foster [this message]
2010-08-12 13:34             ` Tomas Carnecky
2010-08-13  7:03               ` Brian Foster
2010-08-12 17:02 ` [Q] " Brandon Casey
2010-08-13  7:22   ` Brian Foster

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=201008121522.55020.brian.foster@innova-card.com \
    --to=brian.foster@innova-card.com \
    --cc=git@vger.kernel.org \
    --cc=tom@dbservice.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).