Problem
I want to clone an svn repo with git-svn.
The problem is the subversion repository changed layouts at r1235
.
Specifics
From revision 1 to 1234, foo
used the standard svn folder layout with:
- /trunk/src
- /tags/
version
/src
At revision 1235, the author added bar
to the repo. To do so they restructured the master repository making the folder layout look like this:
- /trunk/foo/src
- /trunk/bar/src
- /tags/
version
/foo/src - /tags/
version
/bar/src
Goal
I want a new git repository that has the history of foo
as if it was never rearranged to include bar
.
Relevant Documentation
Working with non standard layouts is discussed in git-svn's documentation.
If the entire history in unnecessary (or if I just want bar
), I can get what I want from r1235 on:
git svn init --stdlayout http://path.to/repo
- edit
repo/.git/config
adding/foo
to relevant paths (or/bar
)
`
[svn-remote "svn"]
url = http://path.to/repo
fetch = trunk/foo:refs/remotes/trunk
branches = branches/*/foo:refs/remotes/*
tags = tags/*/foo:refs/remotes/tags/*
`
git svn fetch -r 1235:HEAD
My attempts
git svn clone -r 1:1234 --stdlayout http://path.to/repo
- edit
repo/.git/config
as above git svn fetch -r 1235:HEAD
Result
The last command seems to succeed because r1235
– HEAD
get downloaded. However, git log
only shows commits up to 1234
. The working directory also seems to be the old revision.
Best Answer
You did just
git svn fetch
, so you now have to check out the latest revision.Any of
git svn rebase
(hm, I am least certain with this one after the path change, but normally it's what you use; it includes fetch),git reset --hard trunk
(forcibly discards local changes),git rebase trunk
(re-applies committed local changes) orgit merge --ff-only trunk
(check there are no local changes) should do and since you don't have local changes yet are equivalent.