5

I am seeing the following output while converting a subversion repo to git.

> Found possible branch point: <repo-url>/trunk => <repo-url>/branches/CMT_PHASE3, 18441
> fatal: Not a valid object name refs/remotes/BlueSimViewer 5.0 20110316 Branch
> cat-file commit refs/remotes/BlueSimViewer 5.0 20110316 Branch: command returned error: 128

The command I am running to convert the repo is

> git svn clone <repo-url> -A authors-transform.txt --stdlayout converted-git > svnlog

This process has already converted 117 branches, some with spaces in their names. I first found this SO question, which helped me move forward from a previous issue solved by git 1.8.x.x.

Any insight as to the cause of this problem and possible ways of fixing it are greatly appreciated.

I am running git version 1.8.1.1 on an Ubuntu 12.10 server. I am happy to provide any other information that would be helpful.

Community
  • 1
  • 1
XBigTK13X
  • 2,655
  • 8
  • 30
  • 39
  • Are there really spaces in the branch name? – Stefan Näwe Jan 17 '13 at 14:14
  • Actually, I double checked the server and the closest branch name I can find is: BlueSimViewer5.0_20110316_Branch. – XBigTK13X Jan 17 '13 at 14:19
  • You can try SubGit for conversion, it has its own conversion engine, so, I think, you won't encounter such an error. – Dmitry Pavlenko Jan 17 '13 at 14:51
  • I notice that you have subgit.com in your profile. I appreciate honest attempts to resolve the question I asked, but your response adds nothing in the way of solving the problem I encountered. As far as I can tell, SubGit is a closed source tool that allows people to continue running Subversion. We are entirely moving away from that VCS, which makes SubGit a project that does not serve my needs. – XBigTK13X Jan 17 '13 at 15:51
  • @Stefan: I should mention that some branches did actually have spaces in their names (ie: Date Patch). – XBigTK13X Jan 17 '13 at 15:54
  • @XBigTK13X Currently the most of the SVN->Git conversion tools (like svn2git or git-svn bridge) run git-svn as the conversion engine, so if you don't find any solution to make git-svn work or it takes too much efforts, you can try the tool I proposed (yes, it's closed source but free for just conversion purposes, i.e. you case). If the information is not helpful, I can delete my comment. – Dmitry Pavlenko Jan 17 '13 at 16:45

2 Answers2

7

Might be too late now but I guess I found a, at least, odd solution.

Open the file git-repo-name/.git/packged-refs that you mentioned and replace the %20 for spaces, save the document and try again. Worked for me.

Edited in Notepad++ with UTF-8.

Git version: git version 2.6.2.windows.1 (win 7 64x via git bash).

Idemax
  • 2,712
  • 6
  • 33
  • 66
  • It seems to work. I followed this procedure for a 9 year old SVN-repository which I just converted. I had to run git svn clone around 10 times to catch all instances of %20 in tag names. – bjaastad_e Jun 08 '16 at 12:46
  • A secondary observation is that after I ran this for the first time I got a series of "ignoring ref with broken name" warnings in the log from the process. I wiped the clone and ran it once more, upon which I did not get the named warnings. I just did the conversion, so I'm not confident that the clone is 100% OK yet, but it seems correct, as far as I can see now. – bjaastad_e Jun 08 '16 at 12:54
6

I found a solution, but I am not satisfied with the result. If someone can provide a way to do this without ignoring the problematic branches, then I am happy to accept his or her answer.

For each branch/tag that throws this error, open the following file

git-repo-name/.git/packged-refs

and place a pound symbol (#) at the start of the line containing the offending branch/tag.

For example, with respect to my question

b88c4df0d47a9ca43c2d0ffd4a1f6e471f98aebc refs/remotes/BlueSimViewer%205.0%2020110316%20Branch

becomes

#b88c4df0d47a9ca43c2d0ffd4a1f6e471f98aebc refs/remotes/BlueSimViewer%205.0%2020110316%20Branch

This marks the line as a comment, and git will continue the conversion process while ignoring the problematic branch.

I am still converting at the time of writing this answer. Although this solution means some branches are missed, at least I will know what branches aren't there.

XBigTK13X
  • 2,655
  • 8
  • 30
  • 39