diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -105,6 +105,16 @@ 'force' => array( 'help' => 'Do not run any sanity checks.', ), + 'keep-redundant-commits' => array( + 'supports' => array('git'), + 'help' => + 'Normally, git will not allow you to cherry-pick empty commits, '. + 'however if you have dependent diffs where some of the '. + 'dependencies have landed into HEAD, then you might want to force '. + 'git to do so to be able to successfully patch dependent diffs. '. + 'This flag gets passed down to git cherry-pick which then cretes '. + 'empty commits for the dependencies.', + ), '*' => 'name', ); } @@ -198,6 +208,10 @@ return true; } + private function shouldKeepRedundantCommits() { + return $this->getArgument('keep-redundant-commits', false); + } + private function getBranchName(ArcanistBundle $bundle) { $branch_name = null; $repository_api = $this->getRepositoryAPI(); @@ -699,7 +713,13 @@ $repository_api->execxLocal('checkout %s', $original_branch); $ex = null; try { - $repository_api->execxLocal('cherry-pick %s', $new_branch); + if ($this->shouldKeepRedundantCommits()) { + $repository_api->execxLocal( + 'cherry-pick --keep-redundant-commits %s', + $new_branch); + } else { + $repository_api->execxLocal('cherry-pick %s', $new_branch); + } } catch (Exception $ex) { // do nothing }