* [BUG?] git remote rm repo nukes local refs for mirror repo
@ 2008-10-14 9:05 Michael J Gruber
2008-10-14 9:32 ` Johannes Schindelin
0 siblings, 1 reply; 4+ messages in thread
From: Michael J Gruber @ 2008-10-14 9:05 UTC (permalink / raw)
To: Git Mailing List
I just noticed the hard way that "git remote rm repo" nukes all local
(mirrored) refs if repo had been setup with "git remote add --mirror
repo url".
Some may argue that this behaviour fits the description "deletes all
remote tracking branches" but I would claim it does not: mirrored
branches are not remote tracking branches in the proper sense.
So:
- Is this behaviour intended?
- If yes, how else would I remove a remote mirror configuration without
destroying a local repo? git config, I know, but that can't be the way.
Michael
Technical:
remote_find_tracking() in remote.c returns "branch" as the remote
tracking branch of "branch" (itself) in a mirror setup. Is this the
right thing to do?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG?] git remote rm repo nukes local refs for mirror repo
2008-10-14 9:05 [BUG?] git remote rm repo nukes local refs for mirror repo Michael J Gruber
@ 2008-10-14 9:32 ` Johannes Schindelin
2008-10-14 10:55 ` Samuel Tardieu
2008-10-14 11:34 ` Michael J Gruber
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schindelin @ 2008-10-14 9:32 UTC (permalink / raw)
To: Michael J Gruber; +Cc: Git Mailing List
Hi,
On Tue, 14 Oct 2008, Michael J Gruber wrote:
> I just noticed the hard way that "git remote rm repo" nukes all local
> (mirrored) refs if repo had been setup with "git remote add --mirror
> repo url".
>
> Some may argue that this behaviour fits the description "deletes all
> remote tracking branches" but I would claim it does not: mirrored
> branches are not remote tracking branches in the proper sense.
Count me into the former group. If you set up a "--mirror" repository, it
defeats the purpose to mix that with _true_ local branches.
I'd color this a pilot error,
Dscho
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG?] git remote rm repo nukes local refs for mirror repo
2008-10-14 9:32 ` Johannes Schindelin
@ 2008-10-14 10:55 ` Samuel Tardieu
2008-10-14 11:34 ` Michael J Gruber
1 sibling, 0 replies; 4+ messages in thread
From: Samuel Tardieu @ 2008-10-14 10:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Michael J Gruber, Git Mailing List
Michael> I just noticed the hard way that "git remote rm repo" nukes
Michael> all local (mirrored) refs if repo had been setup with "git
Michael> remote add --mirror repo url". Some may argue that this
Michael> behaviour fits the description "deletes all remote tracking
Michael> branches" but I would claim it does not: mirrored branches
Michael> are not remote tracking branches in the proper sense.
Johannes> Count me into the former group. If you set up a "--mirror"
Johannes> repository, it defeats the purpose to mix that with _true_
Johannes> local branches.
IMO it should exit with an error and force to use "--force" to perform
the operation. The scenario I envision is a mirror becoming the
primary repository because the original source has disappeared. You
would want to remove the now-useless reference to the source, and
silently nuking all branches is wrong.
Sam
--
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG?] git remote rm repo nukes local refs for mirror repo
2008-10-14 9:32 ` Johannes Schindelin
2008-10-14 10:55 ` Samuel Tardieu
@ 2008-10-14 11:34 ` Michael J Gruber
1 sibling, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2008-10-14 11:34 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Git Mailing List
Johannes Schindelin venit, vidit, dixit 14.10.2008 11:32:
> Hi,
>
> On Tue, 14 Oct 2008, Michael J Gruber wrote:
>
>> I just noticed the hard way that "git remote rm repo" nukes all local
>> (mirrored) refs if repo had been setup with "git remote add --mirror
>> repo url".
>>
>> Some may argue that this behaviour fits the description "deletes all
>> remote tracking branches" but I would claim it does not: mirrored
>> branches are not remote tracking branches in the proper sense.
>
> Count me into the former group. If you set up a "--mirror" repository, it
> defeats the purpose to mix that with _true_ local branches.
>
> I'd color this a pilot error,
> Dscho
OK, I'll give some background about the motivation:
I have a "local" repo.
I want to create a "backup repo" which contains the same branches
(including proper remotes, svn remotes).
So, I create an empty bare repo somewhere (say store:backuprepo.git),
and in the local repo I do:
git remote add --mirror backup store:backuprepo.git
git push backup
I need "mirror=true" because otherwise branches are not created
automatically (on push) on the remote side. I need the '+refs/*:refs/*'
refspec because otherwise not all refs are mirrored. But now I can't use
"git remote rm backup" to remove the configuration because that would
take away all my local branches, too.
Instead, I could set up things with
git remote add backup store:backuprepo.git
git config remote.backup.push '+refs/*:refs/*'
Then all branches are mirrored on the remote automatically. But
interesting things happen after fetch and push... Read "recursion". So,
in order to avoid any remote/backup/foo branches on the local side I
would have to use
git remote add backup store:backuprepo.git
git config remote.backup.push '+refs/*:refs/*'
git config --unset remote.backup.fetch
in order to create a "backup remote" configuration. Maybe I'm just being
dense (which is actually OK for a functional analyst); I'd be happy
about any more direct solution. At least I think there should be one, a
backup bare remote mirror is a common use case, and the config massaging
above is not something to recommend to novice users.
Michael
P.S.: Yeah I know, git's no backup tool, there's rsync... ;)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-14 11:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-14 9:05 [BUG?] git remote rm repo nukes local refs for mirror repo Michael J Gruber
2008-10-14 9:32 ` Johannes Schindelin
2008-10-14 10:55 ` Samuel Tardieu
2008-10-14 11:34 ` Michael J Gruber
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.