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:

  • How to interface PHP and Git repository
  • GIT Pulling and merging generates Staged files and conflicts
  • getting error when trying “git push heroku master”
  • git pull error “The requested URL returned error: 503 while accessing”
  • Git - Accidentally pushed to upstream instead of my branch
  • How to set the root application directory?
  • + 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…)

  • Push git repository to remote subversion with history
  • Git default files (ignoring after first pull)
  • Cannot run Git pull on PowerShell in TFS Build Pipeline
  • Certificate problem while cloning a https url with git
  • Abandoning Git commits on Github for rejected pull requests
  • Missing commits in repo on CircleCI container
  • 2 Solutions collect form web for “Why hg always commit a git submodule, even if it hasn't changed?”

    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.

    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 ?

    Git Baby is a git and github fan, let's start git clone.