Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why hg always commit a git submodule, even if it hasn't changed?

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...)

like image 413
Somebody still uses you MS-DOS Avatar asked May 27 '11 02:05

Somebody still uses you MS-DOS


1 Answers

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.

like image 112
Jan Avatar answered Oct 14 '22 13:10

Jan