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

git checkout HEAD ERROR #330

Closed Jayllyz closed 5 months ago

Jayllyz commented 5 months ago

tested with latest commit & latest release Looks like the script is working but then git checkout gives me :

error: pathspec 'HEAD' did not match any file(s) known to git image

frej commented 5 months ago

[This is a canned reply to issues that contain too little information for effective troubleshooting]

Please have a look at this blog post about writing effective bug reports. For fast-export you should at least:

Jayllyz commented 5 months ago

Hello, thanks for helping me.

I've a lot of repos to convert to git from mercurial, so I made a little script that do like suggested in your repository for all my repos (30~):

git init <repo>
cd <repo>
hg-fast-export.sh -r <repo> -a authors-git
git checkout #also tried HEAD

For all repos it works, expect one, the main repo so he is very huge, maybe it's the reason?

I've provided the error in my initial ticket, using latest python & mercurial (pip install mercurial). Sadly I can't share anything since it's private.

ps: issue template could be useful for bug reports.

frej commented 5 months ago
git init <repo>
cd <repo>
hg-fast-export.sh -r <repo> -a authors-git
git checkout #also tried HEAD

Thanks for the clarification.

git init creates a repo and, by default, places you are on the master branch. If fast-export doesn't create a branch named master, Git will probably be unhappy, for illustration see the following:

$ git init foo
$ cd foo
$ git checkout HEAD
error: pathspec 'HEAD' did not match any file(s) known to git
$ git checkout master
error: pathspec 'master' did not match any file(s) known to git
$ git checkout 
fatal: You are on a branch yet to be born

From the README's section about tag and branch naming: "By default, the default mercurial branch is renamed to the master branch on git. If your Mercurial repo contains both default and master branches, you'll need to override this behavior." My guess is that the Mercurial repo for which git checkout fails when converted, did not have branch named master nor a branch named default. Try git branch --all and check out one of the branches that do exist.

I've provided the error in my initial ticket, using latest python & mercurial (pip install mercurial).

You posted a single error message, followed by a screen shot of the statistics produced by git fast-import, with no indication to the sequence of commands which produced that output. Instead of guessing, I prefer to ask for clarification.

Jayllyz commented 5 months ago

Thanks!