git module always sets '--remote' for submodule updates

Hi,

I'm sending a probe here to see if I got this right before opening an issue.

When a git project is checked out using ansible, submodules are always
updated with the '--remote' option.

https://github.com/ansible/ansible/blob/devel/library/source_control/git#L432

Here is the relevant piece of code :

if 'remote' in params:
  cmd = [ git_path, 'submodule',
          'update', '--init', '--recursive' ,
          '--remote' ]
else:
  cmd = [ git_path, 'submodule',
          'update', '--init', '--recursive' ]
(rc, out, err) = module.run_command(cmd, cwd=dest)

Note that the 'remote' in params is not related to the 'remote' git
module option : tt is automatically gathered from possible 'git
submodule' options (see
https://github.com/ansible/ansible/blob/devel/library/source_control/git#L152).

The problem with this is that git will try to update the submodule to
origin/master by default, and this is not always desirable (in my case,
I don't even have a master branch).

As far as I know, there is not way to handle this righ now, besides
setting branch.<name>.remote and submodule.<name>.branch in .gitmodules.

Can you confirm this is really an issue, or enlighten me otherwise ?

Thanks,

M

There are several tickets already open on the git module.

Bugfix submissions (pull requests) would be great, but I’d avoid opening up an extra ticket on the same subject.

https://github.com/ansible/ansible/search?q=git&ref=cmdform&type=Issues