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

23 views
Skip to first unread message

Michel Blanc

unread,
Jul 21, 2014, 5:42:02 AM7/21/14
to ansible...@googlegroups.com
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
--
Michel Blanc
{ :github => "@leucos", :twitter => "@b9m", :gpg => "0X24B35C22" }

Michael DeHaan

unread,
Jul 21, 2014, 8:33:54 AM7/21/14
to ansible...@googlegroups.com
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.





--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/53CCE063.1090306%40mbnet.fr.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages