git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah"
@ 2008-04-23  8:28 Paolo Bonzini
  2008-04-23  9:59 ` Johannes Schindelin
  2008-04-23 16:07 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Paolo Bonzini @ 2008-04-23  8:28 UTC (permalink / raw)
  To: Git Mailing List, Junio C Hamano, Johannes Schindelin

In the thread "git remote update -> rejected" Junio and Johannes came to 
the conclusion that "--mirror means that you do not have local 
branches", because "you give control away to the other end on the ref 
namespace".  Furthermore, it was agreed that --mirror currently makes 
sense mostly (or only?) on a bare repository.

 From here I gather that if you have "git remote add --mirror", most 
likely the mirrored repository will be the only remote you have.  There 
is in general no point in having other remotes in a bare repository. 
And so there is no loss of generality if this remote is the "origin" remote.

Hence, my proposal is:

1) Add an option to "git clone", to be used with --bare, to create a 
mirror.  --bare already leaves the original refs in place, without 
moving them under refs/remotes/origin, so it makes sense to optionally 
create the remote.

Actually you don't need to add a new option.  Right now, specifying 
-o/--origin together with --bare would give an error; in my proposal, if 
you had "--bare --origin=source" a remote would be created in the config 
file like this:

[remote "source"]
	url = ...
	fetch = +refs/*:refs/*

2) Modify the --mirror option to "git remote add", so that it creates a 
remote *acting as a mirror of this one*.  The config would look like this:

[remote "mirror"]
         url = ...
         fetch = +refs/heads/*:refs/remotes/mirror/*
         push = +refs/heads/*:refs/heads/*
         push = +refs/tags/*:refs/tags/*
         mirror


Now, I know that this is not what was proposed in the original --mirror 
thread, and it is backwards-incompatible.  On the other hand, I think it 
has several advantages:

1) it does not add special cases such as "--mirror is only to be used in 
a --bare repository".  It moves the functionality to a combination of 
options that used to give an error.

2) it provides an easy-to-use UI to create a mirror of this repository 
somewhere.  With a patch I already posted, "git push" would 
automatically update this mirror.

3) overall, I think it makes a lot of sense: "git remote add" is about 
adding one remote of many, and "git clone" is about setting up a single 
special remote.  Now, you can have many remotes that are 
mirrored-from-here, while you can only have one remote that is 
mirrored-to-here.  So, I believe that "git remote add" should add 
mirrored-from-here remotes, while "git clone" should be used to create a 
mirrored-to-here remote.

Opinions?

Paolo

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

end of thread, other threads:[~2008-04-24  6:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23  8:28 [RFC] Moving "git remote add --mirror blah" functionality to "git clone --bare --origin=blah" Paolo Bonzini
2008-04-23  9:59 ` Johannes Schindelin
2008-04-23 16:07 ` Junio C Hamano
2008-04-23 16:56   ` Daniel Barkalow
2008-04-23 22:25     ` Jeff King
2008-04-23 20:06   ` Paolo Bonzini
2008-04-23 22:02     ` Junio C Hamano
2008-04-23 22:42       ` Johannes Schindelin
2008-04-24  6:23       ` Paolo Bonzini

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