git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Q] `git fetch tag NAME' into mirror repo does not update HEAD, what to do?
@ 2010-08-12  7:54 Brian Foster
  2010-08-12  8:33 ` Tomas Carnecky
  2010-08-12 17:02 ` [Q] " Brandon Casey
  0 siblings, 2 replies; 11+ messages in thread
From: Brian Foster @ 2010-08-12  7:54 UTC (permalink / raw)
  To: git


 Bare repository ORIG's master looks like this:

   o--o--o--o--v1--o--v2--o--o--o HEAD

 where v1 and v2 are (annotated) tagged commits.

 Repository SLAVE is a mirror clone of ORIG which
 (very deliberately!) lags behind (i.e., its HEAD
 is one of the earlier (and usually tagged) commits
 on ORIG).  SLAVE's master was like this:

   o--o--o--o--v1 HEAD

 We wanted to update its HEAD to v2, so did:

   git fetch ORIG tag v2

 This gave us:

   o--o--o--o--v1 HEAD
                 \ 
                  o--v2

 It did not update SLAVE's HEAD to v2, which we wanted.
 This was worked-around by editing refs/heads/master(?)
 but we don't want to do that again (esp. since we got
 it wrong the first time (Thank you back-ups!)).

 Whilst we want to switch to a push from ORIG to SLAVE
 model, until that happens (there are some IT issues),
 we are still fetching on SLAVE from ORIG.  Hence, how
 can we avoid the above issue; that is, what should we
 have done?  Searching various docs has failed to find
 any clew or answer.

 There are several GIT versions involved (all(?) are
 1.5-ish or later).  Below is a script to reproduce
 the situation (tested with v1.7.0.2).

cheers!
	-blf-

=====(cut here and below)===== demo.sh =====(git version 1.7.0.2)=====
#!/bin/bash

add_new_files() {
	touch   -- "$@"
	git add -- "$@"
	git commit -m "Added: $*"
}

set -xe

mkdir ORIG
cd ORIG
git init	# ORIG is bare in real case

add_new_files foo
add_new_files bar

git tag -a -m First v1

cd ..
git clone --bare --mirror ORIG SLAVE.git

cd ORIG

add_new_files xyzzy
add_new_files plover

git tag -a -m Update v2

add_new_files stuff
add_new_files more_stuff

cd ../SLAVE.git

git fetch --verbose origin tag v2

# SLAVE's master's HEAD has not changed ....  ;-(

git tag -l
git log --oneline master
git log --oneline v2
=====(cut here and above)===== demo.sh =====(git version 1.7.0.2)=====

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-08-13  7:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).