为什么 hg 总是提交 git 子模块,即使它没有改变?
我有一个 hg 存储库,带有一个 hg 子存储库,其中有一些 git 子模块。 (我知道这听起来完全疯狂,但它正在与 google 代码中的 svn 存储库、github 中的库和 bitbucket 中的模块一起使用。我正在使用由一群人免费提供的代码,我有什么资格抱怨他们的决定版本控制 - 我想要的是代码,对此我很感激)。
关于此场景的一点“树”:
+ hg repo
+ hg subrepo
+ git submodules
当我更改 hg 子存储库中的文件并提交时,它会提交所有 git 子模块,即使它们没有更改。我已经运行了 hg status,它没有显示任何有关 git 子模块的信息,但是如果我提交:
committing subrepository SUBREPO
如果我只使用一个 hg main repo 和一堆git 子模块。问题在于当我在第一个 hg 存储库中进行更改时:现在,当我提交时,它会在 hg 存储库和 hg 子存储库中提交,因为它总是提交 git 子模块。所以现在,我有一个评论,它被设计为仅在第一个 hg 存储库中,并且在 hg 子存储库中也有相同的评论。
对于我使用 git 子模块在 hg 存储库/子存储库上执行的每次提交,如何避免这种间歇性提交子存储库 SUBREPO
?这是一个错误吗?这是一个 git 设计吗(也许 git 存储库总是至少更改一个“状态”文件或类似的东西,在拉取后总是会更改?我对 git 没有太多经验...)
I have a hg repository, with a hg subrepository, which has some git submodules. (I know this sounds completely insane, but it's working with svn repos in google code, in libs in github and modules in bitbucket. I'm using code freely made available by a bunch of people, WHO AM I to complain about their decisions about version control - what I want is the code and I'm grateful for that).
A little "tree" about this scenario:
+ hg repo
+ hg subrepo
+ git submodules
When I change a file in the hg subrepository and commit, it commits all the git submodules, even if they were not changed. I have run hg status
, it doesn't show anything about the git submodules, but if I commit:
committing subrepository SUBREPO
This wouldn't be so problematic, if I were using just one hg main repo with a bunch of git submodules. The problem relies when I make a change in the first hg repository: now, when I commit, it commits in the hg repository AND in the hg subrepository, since it always commits the git submodules. So now, I have a comment that was designed to be at the first hg repository only, and the same comment in the hg subrepository.
How do I avoid this intermitent committing subrepository SUBREPO
, for every commit I do on my hg repository/subrepository with git submodules? Is this a bug? Is this a git design (maybe the git repositories always change at least a "status" file or something like that that always change after a pull? I don't have much experience with git...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
即使拉取什么也得不到,也会触及 git 中的文件...更具体地说是
.git/FETCH_HEAD
文件。我不记得 hg/Mercurial 在这里做了什么,但我怀疑同样的事情。无论如何,如果是空拉取,则文件本身不会更改,只会更改时间戳。您可以通过制作 git/hg 存储库的精确副本来验证这一点,然后仅拉取一个。目录比较工具将显示更改的文件。
如果我没记错我的 hg,
hg status
命令将明确不包含子存储库中的文件,因此您所看到的行为是有意义的。Even a pull that gets nothing will touch files in git... more specifically the
.git/FETCH_HEAD
file. I don't remember how hg/Mercurial does here but I'd suspect the same thing. In any case, if it's an empty pull, then the file itself is not changed, only the time stamp.You can verify this by making an exact copy of your git/hg repository, then pull only in one. A directory compare tool will show you the changed file(s).
If I remember my hg correctly, the
hg status
command will specifically not include files in sub-repositories so the behavior you're seeing makes sense.不知道这是否有帮助,但在 Subrepository 中,第 3.1 节他们解释了如何应该布置子存储库。
但我知道你在这个组织里没有发言权?你能重新组织你的层次结构吗?
don't know if that help, but in Subrepository, section 3.1 they explain how the subrepo should be laid out.
But I understand that you have no say in this organisation ? Can you re-org your hierarchy ?