{"thread":{"id":"38787","subject":"git-svn: Fetch svn branches only and have git recognize them as branches?","startedAt":"2015-03-12T22:30:04Z","lastAt":"2015-03-16T14:27:25Z","messageCount":5,"participants":["Brian Koehmstedt","Junio C Hamano","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"257606","messageId":"CAMMCKnc9AKjuwQ_RNxD_g3tn=xFQkbO1i-U=rP2VLWPi7qizGA@mail.gmail.com","threadId":"38787","inReplyTo":null,"subject":"git-svn: Fetch svn branches only and have git recognize them as branches?","fromName":"Brian Koehmstedt","fromEmail":"bkoehmstedt@berkeley.edu","sentAt":"2015-03-12T22:30:04Z","receivedAt":"2015-03-12T22:30:04Z","isPatch":false,"sender":{"key":"bkoehmstedt@berkeley.edu","avatar":null},"body":"I'm trying deal with a project where the server is disallowing access to\nthe root URL on the subversion server.\n\ni.e.,\nDoesn't allow access: http://abc.com/repo\nDoes allow access: http://abc.com/repo/trunk, http://abc.com/repo/branches,\nhttp://abc.com/repo/tags\n\nI know I can git-svn to clone each separately and get three separate git\nrepositories, which isn't really what I want (Ideally I want one, with the\nbranches and tags recognized).\n\nBut neverminding that for a second, even if I end up with three git\nrepositories, I'd also like to figure out how to get git-svn to clone\nhttp://abc.com/branches and recognize all the top-level directories as a\nbranch in git, rather than it treating it all as separate directories on\none branch.\n\nSame would be true for tags.\n\nIs this possible with .git/config editing?\n\nMy latest failed attempt was this:\n\n[svn-remote \"svn\"]\n        url = http://abc.com/repo/branches\n        fetch = :refs/remotes/svn/branches\n        branches = *:refs/remotes/svn/*\n\ngit svn fetch svn\nThis fetched all the branch directories as one branch.\n"},{"id":"257612","messageId":"xmqq385924j3.fsf@gitster.dls.corp.google.com","threadId":"38787","inReplyTo":"CAMMCKnc9AKjuwQ_RNxD_g3tn=xFQkbO1i-U=rP2VLWPi7qizGA@mail.gmail.com","subject":"Re: git-svn: Fetch svn branches only and have git recognize them as branches?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-12T23:13:20Z","receivedAt":"2015-03-12T23:13:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brian Koehmstedt <bkoehmstedt@berkeley.edu> writes:\n\n> I'm trying deal with a project where the server is disallowing access to\n> the root URL on the subversion server.\n>\n> i.e.,\n> Doesn't allow access: http://abc.com/repo\n> Does allow access: http://abc.com/repo/trunk, http://abc.com/repo/branches,\n> http://abc.com/repo/tags\n\n[warning: I have never used 'git svn' myself for several years]\n\nThe problem sounds like what this commit (which is v1.5.1.5~15)\nfixed:\n\ncommit 4a1bb4c3f87f355dd52fcd0babcbd005d59d7ed6\nAuthor: Eric Wong <normalperson@yhbt.net>\nDate:   Sun May 13 09:58:14 2007 -0700\n\n    git-svn: don't attempt to minimize URLs by default\n    \n    For tracking branches and tags, git-svn prefers to connect\n    to the root of the repository or at least the level that\n    houses branches and tags as well as trunk.  However, users\n    that are accustomed to tracking a single directory have\n    no use for this feature.\n    \n    As pointed out by Junio, users may not have permissions to\n    connect to connect to a higher-level path in the repository.\n    \n    While the current minimize_url() function detects lack of\n    permissions to certain paths _after_ successful logins, it\n    cannot effectively determine if it is trying to access a\n    login-only portion of a repo when the user expects to\n    connect to a part where anonymous access is allowed.\n    \n    For people used to the git-svnimport switches of\n    --trunk, --tags, --branches, they'll already pass the\n    repository root (or root+subdirectory), so minimize URL\n    isn't of too much use to them, either.\n    \n    For people *not* used to git-svnimport, git-svn also\n    supports:\n    \n     git svn init --minimize-url \\\n      --trunk http://repository-root/foo/trunk \\\n      --branches http://repository-root/foo/branches \\\n      --tags http://repository-root/foo/tags\n    \n    And this is where the new --minimize-url command-line switch\n    comes in to allow for this behavior to continue working.\n\nThe description of the commit makes me think that mimicking the\nsample command line without minimize-url ought to work, i.e.\n\n    git svn init \\\n        --trunk    http://abc.com/repo/trunk \\\n        --branches http://abc.com/repo/branches \\\n        --tags     http://abc.com/repo/tags\n\nBut I've never used 'git svn' for several years, so I may be\ncompletely off the mark.\n"},{"id":"257613","messageId":"20150312233338.GA16358@dcvr.yhbt.net","threadId":"38787","inReplyTo":"CAMMCKnc9AKjuwQ_RNxD_g3tn=xFQkbO1i-U=rP2VLWPi7qizGA@mail.gmail.com","subject":"Re: git-svn: Fetch svn branches only and have git recognize them as branches?","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2015-03-12T23:33:38Z","receivedAt":"2015-03-12T23:33:38Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Brian Koehmstedt <bkoehmstedt@berkeley.edu> wrote:\n> My latest failed attempt was this:\n> \n> [svn-remote \"svn\"]\n>         url = http://abc.com/repo/branches\n>         fetch = :refs/remotes/svn/branches\n>         branches = *:refs/remotes/svn/*\n> \n> git svn fetch svn\n> This fetched all the branch directories as one branch.\n\nYou probably do not need the \"fetch\" line there, only:\n\n[svn-remote \"svn\"]\n        url = http://abc.com/repo/branches\n        branches = *:refs/remotes/svn/*\n\nI haven't used the branches/tags functionality of git-svn in\nmany years, though.\n"},{"id":"257614","messageId":"loom.20150313T004740-11@post.gmane.org","threadId":"38787","inReplyTo":"xmqq385924j3.fsf@gitster.dls.corp.google.com","subject":"Re: git-svn: Fetch svn branches only and have git recognize them as branches?","fromName":"Brian Koehmstedt","fromEmail":"bkoehm@gmail.com","sentAt":"2015-03-12T23:51:40Z","receivedAt":"2015-03-12T23:51:40Z","isPatch":false,"sender":{"key":"bkoehm@gmail.com","avatar":null},"body":"Junio C Hamano <gitster <at> pobox.com> writes:\n> \n>      git svn init --minimize-url \\\n>       --trunk http://repository-root/foo/trunk \\\n>       --branches http://repository-root/foo/branches \\\n>       --tags http://repository-root/foo/tags\n> \n>     And this is where the new --minimize-url command-line switch\n>     comes in to allow for this behavior to continue working.\n> \n> The description of the commit makes me think that mimicking the\n> sample command line without minimize-url ought to work, i.e.\n> \n>     git svn init \\\n>         --trunk    http://abc.com/repo/trunk \\\n>         --branches http://abc.com/repo/branches \\\n>         --tags     http://abc.com/repo/tags\n> \n\nSounds like what I need.  But both of these are yielding the following error:\n\n\"E: 'http:/abc.com/foo/trunk' is not a complete URL  and a separate URL is\nnot specified\"\n\nNotice the one slash after http:.\n\nHere's the exact script I'm running to test:\n\n$ cat sample.sh \n#!/bin/sh\n\nrm -rf .git\n\ngit svn init \\\n      --trunk http://abc.com/foo/trunk \\\n      --branches http://abc.com/foo/branches \\\n      --tags http://abc.com/foo/tags\n"},{"id":"257783","messageId":"loom.20150316T152127-59@post.gmane.org","threadId":"38787","inReplyTo":"loom.20150313T004740-11@post.gmane.org","subject":"Re: git-svn: Fetch svn branches only and have git recognize them as branches?","fromName":"Brian Koehmstedt","fromEmail":"bkoehm@gmail.com","sentAt":"2015-03-16T14:27:25Z","receivedAt":"2015-03-16T14:27:25Z","isPatch":false,"sender":{"key":"bkoehm@gmail.com","avatar":null},"body":"Just to close the loop on this, I wasn't able to get git-svn to deal with\nthis remote repository the way I wanted, so what I did is write some perl\nscripts to mirror the remote subversion repository locally and then use\ngit-svn on that local \"fixed\" svn mirror.\n\nThe hard part was mirroring the svn repo locally, primarily because the\nremote subversion server was denying access to the root.  Also complicating\nmatters was the dump files weren't completely loading properly.\n\nIn case anyone else is needing to do this, I've published my perl script\ncode that overcame all these issues.  Here it is:\nhttps://github.com/ucidentity/failsafe-svn-sync\n"}]}