sync submodules after git submodule update
ClosedPublic

Authored by mmodell on Oct 26 2017, 8:57 PM.

Details

Maniphest Tasks
T179013: Scap failing to rewrite submodule urls in beta
Reviewers
demon
awight
hashar
Group Reviewers
Release-Engineering-Team
Commits
rMSCA53bd70674e28: sync submodules after git submodule update
Patch without arc
git checkout -b D849 && curl -L https://phabricator.wikimedia.org/D849?download=true | git apply
Summary

git submodule sync skips uninitialized submodules so for the
remap to be effective we have to run sync + init again.

Diff Detail

Repository
rMSCA Scap
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mmodell created this revision.Oct 26 2017, 8:57 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald TranscriptOct 26 2017, 8:57 PM
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript
mmodell updated this revision to Diff 2234.Oct 26 2017, 9:00 PM

sync_submodules + rerun submodule update

demon updated this revision to Diff 2235.Oct 26 2017, 9:06 PM

Rebased

demon accepted this revision.Oct 26 2017, 9:07 PM
This revision is now accepted and ready to land.Oct 26 2017, 9:07 PM
hashar requested changes to this revision.Oct 27 2017, 8:27 AM
hashar added a subscriber: hashar.
hashar added inline comments.
scap/git.py
380

I would sync just after the remap_submodules() have been called. Then when update --init is called either:

A) the module has been previously initialized, git submodule sync update the URL and the update works

B) the module has NOT been initialized, the sync skips it but given it is not initialized update --init will set the proper URL.

So the flow would be:

if not use_upstream:
    remap_submodules(location, git_remote)
    # Update already initialized modules
    sync_submodules(location)

subprocess.check_call(['git', 'submodule', 'update', '--init'])
# unitialized submodules get the remapped URL
This revision now requires changes to proceed.Oct 27 2017, 8:27 AM
mmodell marked an inline comment as done.Oct 27 2017, 11:01 AM
mmodell added inline comments.
scap/git.py
380

@hashar: If that would work then the previous version of the code would work - since it was calling remap_submodules before git submodule update --init

I'll try it your way but I'm not convinced...

mmodell updated this revision to Diff 2236.Oct 27 2017, 11:02 AM
mmodell marked an inline comment as done.

Try @hashar's suggestion

This revision is now accepted and ready to land.Oct 27 2017, 11:39 AM
This revision was automatically updated to reflect the committed changes.