1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2025-02-16 16:58:38 +01:00

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
This commit is contained in:
Bob Trahan 2014-04-11 13:07:54 -07:00
parent 77a9c18140
commit 43792895a6

View file

@ -62,6 +62,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
private $command; private $command;
private $stashed; private $stashed;
private $shouldAmend;
private $projectInfo; private $projectInfo;
private $repositoryInfo; private $repositoryInfo;
@ -913,7 +914,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
} }
if ($must_commit) { if ($must_commit) {
if ($this->shouldAmend()) { if ($this->getShouldAmend()) {
$commit = head($api->getLocalCommitInformation()); $commit = head($api->getLocalCommitInformation());
$api->amendCommit($commit['message']); $api->amendCommit($commit['message']);
} else if ($api->supportsLocalCommits()) { } else if ($api->supportsLocalCommits()) {
@ -926,8 +927,11 @@ abstract class ArcanistBaseWorkflow extends Phobject {
} }
} }
private function shouldAmend() { private function getShouldAmend() {
return $this->calculateShouldAmend(); if ($this->shouldAmend === null) {
$this->shouldAmend = $this->calculateShouldAmend();
}
return $this->shouldAmend;
} }
private function calculateShouldAmend() { private function calculateShouldAmend() {
@ -1000,7 +1004,7 @@ abstract class ArcanistBaseWorkflow extends Phobject {
} }
private function getAskForAddPrompt(array $files) { private function getAskForAddPrompt(array $files) {
if ($this->shouldAmend()) { if ($this->getShouldAmend()) {
$prompt = pht( $prompt = pht(
'Do you want to amend these files to the commit?', 'Do you want to amend these files to the commit?',
count($files)); count($files));