0

So here's some background: I'm trying to move a repository from Mercurial to git using hg-fast-export and when I do the last step (git checkout HEAD) there are still changes that persist in the repository. Specifically, it says that there are 4 deleted files that shouldn't be deleted.

When I try the following, nothing changes:

git reset --hard HEAD, git checkout ., git stash && git stash drop.

One thing I noticed is odd was that when someone was using this Mercurial repo, they added a git repo right in the middle of it T_T. So the interesting thing is when I run git checkout HEAD (but not when I run git checkout .), the .git subdirectory appears as deleted in the index (weird). These changes disappear whenever I run git reset but not without a bunch of errors flying past about an Invalid path.

Finally, that leaves the repository in the same state it was in when I first ran git checkout HEAD. (At least git's consistant!).

Surely a subset of the people converting mercurial to git has experienced this. Can anybody share their experiences with changes persisting within git?

Caustic
  • 475
  • 3
  • 14
  • err, what is the point of `git checkout HEAD` ? Just after `git reset --hard` what is shown by `git status`? – Balog Pal Jul 02 '13 at 16:10
  • I'm not sure what the point of `git checkout HEAD` is besides updating the working copy of the repository to the HEAD from wherever it was before you ran the script. After I run `git reset --hard HEAD` I am left with the same 4 files that are listed as deleted in the index that shouldn't be. They exist on the filesystem but git won't unstage the deletions if I run the above commands. – Caustic Jul 02 '13 at 16:23
  • As I see it `git checkout HEAD` is a no-op. And you expect it to actually do something. – Balog Pal Jul 02 '13 at 16:34

1 Answers1

0

The cause of this problem was indeed the fact that there was a .git directory inside the mercurial repository.

The way I solved it was running hg convert with a filemap excluding the trouble directory before doing the fast export conversion.

Hope this helps someone in the future!

Caustic
  • 475
  • 3
  • 14