{"thread":{"id":"17306","subject":"How to prefix existing svn remotes?","startedAt":"2009-01-22T17:32:11Z","lastAt":"2009-01-23T17:51:42Z","messageCount":6,"participants":["Sébastien Mazy","Michael J Gruber","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101555","messageId":"20090122173211.GB21798@locahost","threadId":"17306","inReplyTo":null,"subject":"How to prefix existing svn remotes?","fromName":"Sébastien Mazy","fromEmail":"melyadon@gmail.com","sentAt":"2009-01-22T17:32:11Z","receivedAt":"2009-01-22T17:32:11Z","isPatch":false,"sender":{"key":"melyadon@gmail.com","avatar":null},"body":"Hi all,\n\n\nI created a few months ago a git-svn repository using:\ngit svn clone -s https://my_svn_repo .\n\nwich also created the following remotes:\ngit branch -r\n  branch0\n  tags/tag0\n  trunk\n\nI would like to prefix theses remotes, so that it shows:\ngit branch -r\n  prefix/branch0\n  prefix/tags/tag0\n  prefix/trunk\n\nOf course I should have used the -prefix back when creating the repo but\nit's too late. 'git help svn' doesn't explain how to achieve that and\nsimply editing .git/config to add the missing prefix will cause the next\n'git svn fetch' to download again the whole history (which in my case is\nhuge).\n\n\nIs it possible? Did I miss something obvious?\n\n\nCheers,\n\n-- \nSébastien Mazy\n"},{"id":"101649","messageId":"4979A64E.6030608@drmicha.warpmail.net","threadId":"17306","inReplyTo":"20090122173211.GB21798@locahost","subject":"Re: How to prefix existing svn remotes?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-23T11:13:18Z","receivedAt":"2009-01-23T11:13:18Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sébastien Mazy venit, vidit, dixit 22.01.2009 18:32:\n> Hi all,\n> \n> \n> I created a few months ago a git-svn repository using:\n> git svn clone -s https://my_svn_repo .\n> \n> wich also created the following remotes:\n> git branch -r\n>   branch0\n>   tags/tag0\n>   trunk\n> \n> I would like to prefix theses remotes, so that it shows:\n> git branch -r\n>   prefix/branch0\n>   prefix/tags/tag0\n>   prefix/trunk\n> \n> Of course I should have used the -prefix back when creating the repo but\n> it's too late. 'git help svn' doesn't explain how to achieve that and\n> simply editing .git/config to add the missing prefix will cause the next\n> 'git svn fetch' to download again the whole history (which in my case is\n> huge).\n> \n> \n> Is it possible? Did I miss something obvious?\n\nYes! Depends!\n\nThe following works for me:\n\n0) fetch to make sure you're current (optional)\n1) edit .git/config and add the prefix (right hand side of the\nrefpsecs), or really rename in any way you want\n2) rename the existing remote branches in the same way\n\nThe next git svn fetch will rebuild the map file (which is fast) but not\nrefetch any svn revisions you already have.\n\nRegarding the renaming: Either I'm dumb or current git branch can't\nrename git svn branches. I guess it's because they are remotes but not\nreally. I had to resort to git update-ref. I'll look into that.\n\nMichael\n"},{"id":"101653","messageId":"20090123124231.GA17616@locahost","threadId":"17306","inReplyTo":"4979A64E.6030608@drmicha.warpmail.net","subject":"Re: How to prefix existing svn remotes?","fromName":"Sébastien Mazy","fromEmail":"melyadon@gmail.com","sentAt":"2009-01-23T12:42:31Z","receivedAt":"2009-01-23T12:42:31Z","isPatch":false,"sender":{"key":"melyadon@gmail.com","avatar":null},"body":"Hi Michael,\n\nThanks for your reply.\n\nOn Fri, Jan 23, 2009 at 12:13:18PM +0100, Michael J Gruber wrote:\n> The following works for me:\n> \n> 0) fetch to make sure you're current (optional)\n> 1) edit .git/config and add the prefix (right hand side of the\n> refpsecs), or really rename in any way you want\n\nOK.\n\n> 2) rename the existing remote branches in the same way\n\nI'm not sure how I can do it. 'trunk' is the only remote-tracking svn\nbranches under .git/refs/. Here is how it looks:\n\nls -R .git/refs\n .git/refs:  heads  remotes  tags\n .git/refs/heads:  master\n .git/refs/remotes:  trunk\n\nStill, a 'branch0' remote exist:\n\ngit show-ref\n refs/heads/master\n refs/remotes/branch0\n refs/remotes/trunk\n\n-- \nSébastien Mazy\n"},{"id":"101655","messageId":"4979BFE7.8090402@drmicha.warpmail.net","threadId":"17306","inReplyTo":"20090123124231.GA17616@locahost","subject":"Re: How to prefix existing svn remotes?","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-23T13:02:31Z","receivedAt":"2009-01-23T13:02:31Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sébastien Mazy venit, vidit, dixit 23.01.2009 13:42:\n> Hi Michael,\n> \n> Thanks for your reply.\n> \n> On Fri, Jan 23, 2009 at 12:13:18PM +0100, Michael J Gruber wrote:\n>> The following works for me:\n>>\n>> 0) fetch to make sure you're current (optional)\n>> 1) edit .git/config and add the prefix (right hand side of the\n>> refpsecs), or really rename in any way you want\n> \n> OK.\n> \n>> 2) rename the existing remote branches in the same way\n> \n> I'm not sure how I can do it. 'trunk' is the only remote-tracking svn\n> branches under .git/refs/. Here is how it looks:\n> \n> ls -R .git/refs\n>  .git/refs:  heads  remotes  tags\n>  .git/refs/heads:  master\n>  .git/refs/remotes:  trunk\n> \n> Still, a 'branch0' remote exist:\n> \n> git show-ref\n>  refs/heads/master\n>  refs/remotes/branch0\n>  refs/remotes/trunk\n\nYou can do (bash)\n\nfor b in trunk branch0\ndo\n  git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b\n  git update-ref -d refs/remotes/$b\ndone\n\nOTOH, any incarnation of \"git -m\" (with or without \"-r\", specifying\nrefs/remotes/trunk, remotes/trunk or trunk) failed.\n\nMichael\n"},{"id":"101666","messageId":"20090123171355.GA20413@locahost","threadId":"17306","inReplyTo":"4979BFE7.8090402@drmicha.warpmail.net","subject":"Re: How to prefix existing svn remotes?","fromName":"Sébastien Mazy","fromEmail":"melyadon@gmail.com","sentAt":"2009-01-23T17:13:55Z","receivedAt":"2009-01-23T17:13:55Z","isPatch":false,"sender":{"key":"melyadon@gmail.com","avatar":null},"body":"On Fri, Jan 23, 2009 at 02:02:31PM +0100, Michael J Gruber wrote:\n> You can do (bash)\n> \n> for b in trunk branch0\n> do\n>   git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b\n>   git update-ref -d refs/remotes/$b\n> done\n\nThat did the trick. Thank you so much!\n\nBy the way, my renamed remote tracking svn branches now show under\n.git/refs/ as expected.\n\n-- \nSébastien Mazy\n"},{"id":"101671","messageId":"gld029$sa$1@ger.gmane.org","threadId":"17306","inReplyTo":"20090123171355.GA20413@locahost","subject":"Re: How to prefix existing svn remotes?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-23T17:51:42Z","receivedAt":"2009-01-23T17:51:42Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sébastien Mazy wrote:\n\n> By the way, my renamed remote tracking svn branches now show under\n> .git/refs/ as expected.\n\nThey were inside file .git/packed-refs\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}