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...)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With