From 43792895a679d0d50acd2b8a34e5d246ebe3203a Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Fri, 11 Apr 2014 13:07:54 -0700 Subject: [PATCH] Arcanist - fix shouldAmend code Summary: make it a real member variable. See rARC77a9c1814063 and D8753#33914. Test Plan: sending up this diff! Reviewers: shadowhand, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D8761 --- src/workflow/ArcanistBaseWorkflow.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php index d0fcd929..86837073 100644 --- a/src/workflow/ArcanistBaseWorkflow.php +++ b/src/workflow/ArcanistBaseWorkflow.php @@ -62,6 +62,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { private $command; private $stashed; + private $shouldAmend; private $projectInfo; private $repositoryInfo; @@ -913,7 +914,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { } if ($must_commit) { - if ($this->shouldAmend()) { + if ($this->getShouldAmend()) { $commit = head($api->getLocalCommitInformation()); $api->amendCommit($commit['message']); } else if ($api->supportsLocalCommits()) { @@ -926,8 +927,11 @@ abstract class ArcanistBaseWorkflow extends Phobject { } } - private function shouldAmend() { - return $this->calculateShouldAmend(); + private function getShouldAmend() { + if ($this->shouldAmend === null) { + $this->shouldAmend = $this->calculateShouldAmend(); + } + return $this->shouldAmend; } private function calculateShouldAmend() { @@ -1000,7 +1004,7 @@ abstract class ArcanistBaseWorkflow extends Phobject { } private function getAskForAddPrompt(array $files) { - if ($this->shouldAmend()) { + if ($this->getShouldAmend()) { $prompt = pht( 'Do you want to amend these files to the commit?', count($files));