nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

error: pathspec 'master' did not match any file(s) known to git. #41

Open ensonic opened 12 years ago

ensonic commented 12 years ago

Instead of hijacking ticket #23, I'll try as a new one as it might be a different issue. See the log below:

I am getting a bit desperate and wonder what else I could try to shed light on this issue. Should't "git branch -l" show something already. Maybe you could add some sanity checks after each step and error out earlier. I have the feeling that the error in the description just means "sonmething failed along the way" :/

The only result is a single 24bytes small file (among the usual git infrastructure) .git/svn/refs/remotes/svn/trunk/.rev_map.489a8a1a-d840-0410-b443-d4df6bd36c0d

svn2git https://buzztard.svn.sourceforge.net/svnroot/buzztard/trunk/bml --username ensonic --authors ../authors.txt --verbose --nobranches Running command: git svn init --prefix=svn/ --username=ensonic --no-metadata --trunk=trunk --tags=tags https://buzztard.svn.sourceforge.net/svnroot/buzztard/trunk/bml Initialized empty Git repository in /home/ensonic/projects/buzztard/git/bml/.git/ Using higher level of URL: https://buzztard.svn.sourceforge.net/svnroot/buzztard/trunk/bml => https://buzztard.svn.sourceforge.net/svnroot/buzztard Running command: git config --local svn.authorsfile ../authors.txt Running command: git svn fetch W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/trunk/bml' W: Do not be alarmed at the above message git-svn is just searching aggressively for old history. This may take a while on large repositories Checked through r100 Running command: git branch -l --no-color Running command: git branch -r --no-color Running command: git checkout -f master error: pathspec 'master' did not match any file(s) known to git. command failed: 2>&1 git checkout -f master

ensonic commented 12 years ago

Okay, it seem that one needs to convert the whole repository and then use git filter-branch remove subprojects. That is if one has: trunk/ project1/ project2/

one cannot run svn2git using http://server.com/trunk/project1, but instead need to run it using http://server.com for each project and then filter: git filter-branch --subdirectory-filter --tag-name-filter cat -- --all

Now I still need to figure how to fixup the messed up tags.

andrewfhart commented 12 years ago

Hey @ensonic, I was getting the same error you reported. Here's what I did to get just what I wanted out of svn2git for a single nested subproject:

To export project 'x' in a repo at http://example.org/svn, where 'x' is a nested project with structure ./x/trunk ./x/branches and ./x/tags, and where the first revision in which 'x' appears in the repository is r153, I did:

svn2git http://example.org/svn --verbose --revision 153 --trunk x/trunk --branches x/branches --tags x/tags

and it seems to have figured everything out nicely for project 'x'. Basically, I just pushed the project name (x) onto the --trunk, --branches, and --tags paths and it worked out alright.

Thanks for your comment on this issue, it got me started on the right train of thought!

technicalreality commented 12 years ago

In my case I got the error above due to an issue somewhere in the .git directory. I deleted the .git directory and re-ran svn2git and things started working.

lvnilesh commented 12 years ago

svn2git http://svn.quantsoftware.org/openquantsoftware/trunk --verbose Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches http://svn.quantsoftware.org/openquantsoftware/trunk Initialized empty Git repository in /Users/nilesh/projects/test/.git/ Using higher level of URL: http://svn.quantsoftware.org/openquantsoftware/trunk => http://svn.quantsoftware.org/openquantsoftware Running command: git svn fetch Running command: git branch -l --no-color Running command: git branch -r --no-color Running command: git config --local --get user.name Running command: git config --local --get user.email Running command: git checkout -f master error: pathspec 'master' did not match any file(s) known to git. command failed: 2>&1 git checkout -f master

zakkak commented 11 years ago

I second @technicalreality. Removing .git fixed my problem.

tforster commented 11 years ago

I'm getting the same issue. I've removed the .git folder but still the same error message. Any other thoughts?

tforster commented 11 years ago

FYI, it is with one of our original projects in SVN from quite a while ago. I see that the containing folder immediately below trunk was renamed. Originally www it is now webcontent. Could the renaming be affecting it?

madrugado commented 11 years ago

Thanks for the tip, @technicalreality. It's work for me like a charm.

Also I've an issue with svn2git similar to @tforster 's one. In my case the clue was to understand that trunk folder has the name of the project itself, so the option "--rootistrunk" was my choice. Hope this'll help.

abhinavsingh commented 11 years ago

@technicalreality Thanks for that tip. Deleted .git folder and re-run svn2git, all is good now. Though I wonder why this tip works.

drmjc commented 11 years ago

thanks to @andrewfhart and @technicalreality and @btjones from https://github.com/nirvdrum/svn2git/issues/59)

I wanted to convert a heavily nested SVN repo to individual git repo's. eg https://server.com/svn/inteomics/Mark/R/excelIO/ where each project had to traditional structure: {trunk,branches,tags}

I needed to do 3 things: 1) use a fresh folder -- ie no .git 2) enable -v and enter my password every time the 'Authentication realm: https://server:443 Subversion Repositories' message popped up (>5 times). 3) explicitly specify --trunk, --branches and --tags as below:

svn2git https://server.com/svn/inteomics --username marcow -v --trunk Mark/R/excelIO/trunk --branches Mark/R/excelIO/branches --tags Mark/R/excelIO/tags