From: vrana Date: Mon, 19 Nov 2012 22:14:38 +0000 (-0800) Subject: Don't use empty commit message in commit from `arc diff` X-Git-Tag: conduit-6~19 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=dfdacc7f9ad476797adeed84a209e95031047de7;p=arcanist.git Don't use empty commit message in commit from `arc diff` Summary: There was a bug in Git: https://github.com/git/git/commit/d9a935 Also fix a bug with discovering existing commits. Test Plan: $ arc diff # yes # abort $ arc diff # didn't see fatal Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2025 Differential Revision: https://secure.phabricator.com/D3983 --- diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php index 3e9ade25..1b9cccd1 100644 --- a/src/workflow/ArcanistBaseWorkflow.php +++ b/src/workflow/ArcanistBaseWorkflow.php @@ -40,6 +40,8 @@ abstract class ArcanistBaseWorkflow { const COMMIT_ALLOW = 1; const COMMIT_ENABLE = 2; + const AUTO_COMMIT_TITLE = 'Automatic commit by arc'; + private $commitMode = self::COMMIT_DISABLE; private $shouldAmend; @@ -827,7 +829,7 @@ abstract class ArcanistBaseWorkflow { $commit = head($api->getLocalCommitInformation()); $api->amendCommit($commit['message']); } else if ($api->supportsRelativeLocalCommits()) { - $api->doCommit(''); + $api->doCommit(self::AUTO_COMMIT_TITLE); } } } @@ -865,7 +867,7 @@ abstract class ArcanistBaseWorkflow { $known_commits = $this->getConduit()->callMethodSynchronous( 'diffusion.getcommits', array('commits' => array('r'.$callsign.$commit['commit']))); - if ($known_commits) { + if (ifilter($known_commits, 'error', $negate = true)) { return false; } } diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php index aefe6fc5..6f09a6c7 100644 --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -1933,6 +1933,9 @@ EOTEXT $messages = array(); foreach ($local as $hash => $info) { $text = $info['message']; + if (trim($text) == self::AUTO_COMMIT_TITLE) { + continue; + } $obj = ArcanistDifferentialCommitMessage::newFromRawCorpus($text); $messages[$hash] = $obj; } @@ -2163,6 +2166,9 @@ EOTEXT foreach ($usable as $message) { // Pick the first line out of each message. $text = trim($message); + if ($text == self::AUTO_COMMIT_TITLE) { + continue; + } $text = head(explode("\n", $text)); $default[] = ' - '.$text."\n"; }