diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php index a2b3fe40..dba98fb0 100644 --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -714,9 +714,6 @@ EOTEXT throw new ArcanistUsageException(pht('Unable to apply patch!')); } - // in case there were any submodule changes involved - $repository_api->execPassthru('submodule update --init --recursive'); - if ($this->shouldCommit()) { if ($bundle->getFullAuthor()) { $author_cmd = csprintf('--author=%s', $bundle->getFullAuthor()); @@ -754,6 +751,11 @@ EOTEXT } } + // Synchronize submodule state, since the patch may have made changes + // to ".gitmodules". We do this after we finish managing branches so + // the behavior is correct under "--nobranch"; see PHI648. + $repository_api->execPassthru('submodule update --init --recursive'); + echo phutil_console_format( "** %s ** %s\n", pht('OKAY'),