Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with oddly named branch #165

Closed
GregWoods opened this issue Sep 12, 2019 · 4 comments
Closed

Error with oddly named branch #165

GregWoods opened this issue Sep 12, 2019 · 4 comments
Labels
user-support Help to users, can turn into a verfied bug if it turns out to be a problem with fast-export

Comments

@GregWoods
Copy link

GregWoods commented Sep 12, 2019

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
Copy link
Owner

frej commented Sep 12, 2019

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:

  • For historical reasons (before the branch map mechanism was added) fast-export (imperfectly) mangles branch names it thinks won't be valid. I can't remove that functionality and say that maps are what should be used as it would break already existing incremental imports. If you have a branch name that fast-export decides to mangle you'll get a printout of the form Warning: sanitized branch [<unmangled>] to [<mangled>]. The branch map applies to the branch names before mangling, so that is probably the reason you can't find the troublesome branch in the repo, make sure to remap <unmangled> and it should work.

  • Hg allows you to have a branch named a and another a/b, something that can't be represented in git as you can't have a file containing the hash of the head of a in refs/heads/a and the head of a/b in the file refs/heads/a/b in the same file system.

@frej frej added the user-support Help to users, can turn into a verfied bug if it turns out to be a problem with fast-export label Sep 12, 2019
@frej
Copy link
Owner

frej commented Sep 13, 2019

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

frej added a commit that referenced this issue Sep 19, 2019
This tries to preemptively avoid recurrence of issues #148, #152,
 #155, #165 and #168.
@GregWoods
Copy link
Author

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
Copy link
Owner

frej commented Sep 24, 2019

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.

@frej frej closed this as completed Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-support Help to users, can turn into a verfied bug if it turns out to be a problem with fast-export
Projects
None yet
Development

No branches or pull requests

3 participants
@GregWoods @frej and others