felipec / git-remote-hg

Transparent bidirectional bridge between Git and Mercurial for Git
GNU General Public License v2.0
369 stars 87 forks source link

Extra lines in commit comment changes the commit hash - breaks hg-git interoperability #87

Closed drandreasdr closed 2 years ago

drandreasdr commented 2 years ago

Hi!

I just converted a Mercurial repo to git via git-remote-hg, and I get different commit hashes compared to the last time I converted the repo, 1-2 years ago.

Comparison of git log output for the converted repo, for the repo converted a few years ago (left) and the one converted today (right): image

The original mercurial commit looks like this: image (where I hope you'll excuse me obscuring some sensitive information)

I can see in the git-remote-hg source code when and why this extra text in the comment (prefixed by --HG--) is added. But I'm puzzled as to why this text is absent in the git repo that I converted a few years ago, and present in the one I converted today.

Do you know of any setting, configuration, or version discrepancy that could explain this difference? Do you have any recommendations for how I could achieve a one-to-one hg->git conversion such that I can preserve interoperability?

Best Regards, Andreas

drandreasdr commented 2 years ago

Ah, I just figured it out. This setting in my ~/.gitconfig was causing the problem:

[remote-hg]
hg-git-compat = true

Setting it to false solved the problem. Closing the issue, and hoping that it can help someone else.

felipec commented 2 years ago

@drandreasdr Yes, you probably converted it initially with hg-git.