frej / fast-export

A mercurial to git converter using git-fast-import
http://repo.or.cz/w/fast-export.git
808 stars 255 forks source link

Error with oddly named branch #165

Closed GregWoods closed 5 years ago

GregWoods commented 5 years ago

error: cannot lock ref 'refs/heads/VladK_#160_Export_Selected_Question/Question_Transcript"_crashes_if_board_is_empty_(no_questions)': Unable to create 'C:/Projects/magicbullet/.git/refs/heads/VladK_#160_Export_Selected_Question/Question_Transcript"_crashes_if_board_is_empty_(no_questions).lock': Invalid argument

I know from reading around the subject the slashes can be a problem, but the odd double-quote in the middle looks like it could be the problem.

I have tried adding -B argument, where the file contains:

"VladK_#160_Export_Selected_Question/Question_Transcript\"_crashes_if_board_is_empty_(no_questions)"="VladK_#160_Export_Selected_Question__Question_Transcript_crashes_if_board_is_empty_(no_questions)"

Also, I cannot find any reference to this branch in the repository. I asm assuming this is a branch, but maybe it is a tag? The map file doesn't fix the problem.

Any suggestions would be appreciated.

frej commented 5 years ago

Yes that error is due to git requiring that a branch name must be a valid filename or path + filename on the host system. Using the branch map is the correct way to handle it, but there are two potential gotchas:

frej commented 5 years ago

Also consider if you want to use the new -n-flag from 1181a0af471fe473919b30f476a253a9ae2282b0 from the new v190913 release.

GregWoods commented 5 years ago

Adding the -n flag to my command line has fixed the issue, Thank you! I would still like to see an example of a valid branch map file, because I couldn't get it to do anything useful. However, this issue as raised, is resolved.

Note: I switched to using Ubuntu 18.04LTS on Windows Subsystem for Linux instead of Git Bash, mostly to get a clean, reproducible environment. It works well.

frej commented 5 years ago

If it starts working with -n and an empty map file it's probably due to the automatic mangling, with among other things removes duplicated _ which probably can lead to clashes between two branches.

If you want to test out the branch mapping, run hg branches and pick a branch name from that list to rename, then run with -n -B <mapfile>. If that doesn't work, create a new issue for this.