Search code examples
gitgit-svn

Migrating a non standard layout svn repository to git


I have a local svn repository with a non standard layout, i.e., without trunk, branches and tags and with many "flat" projects. It's like this:

<repo root>/project1/<source files>
<repo root>/project2/<source files>
...

I want each project to get into a separate git repo.

I'm doing the authors conversion step 1 as described in this guide

and then using this command instead of the one in step 2:

cd <repo root>/project1/
git svn clone file:///<path to root>/project1 --no-metadata -T ./ --authors-file=authors-transform.txt ~/temp.git

I don't use the --stdlayout, because I don't have such layout, and I also use the -T option to denote where the trunk should be found for this repo. The step seems to run ok, and ~/temp.git contains the source files of the project. I can see the commit logs and the change in there with git log, git diff.

Then I'm executing next two steps as they are given in the guide. Step 4 gives the following output:

$ git push bare
Counting objects: 534, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (499/499), done.
Writing objects: 100% (534/534), 281.99 KiB | 2.82 MiB/s, done.
Total 534 (delta 261), reused 0 (delta 0)
remote: Resolving deltas: 100% (261/261), done.
To /home/thanos/new-bare.git
 * [new branch]      origin/trunk -> origin/trunk

which I don't know if it's correct. Step 5 is then failing:

$ git branch -m trunk master
error: refname refs/heads/trunk not found
fatal: Branch rename failed

Any clue what I 'm doing wrong? Is the use of -T in step 2 correct? And the no use of --stdlayout?


Solution

    • [new branch] origin/trunk -> origin/trunk

    You don't have branch trunk so you cannot rename it; you have origin/trunk.