1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 23:02:41 +01:00

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
This commit is contained in:
vrana 2012-11-19 14:14:38 -08:00
parent b71666a24a
commit dfdacc7f9a
2 changed files with 10 additions and 2 deletions

View file

@ -40,6 +40,8 @@ abstract class ArcanistBaseWorkflow {
const COMMIT_ALLOW = 1; const COMMIT_ALLOW = 1;
const COMMIT_ENABLE = 2; const COMMIT_ENABLE = 2;
const AUTO_COMMIT_TITLE = 'Automatic commit by arc';
private $commitMode = self::COMMIT_DISABLE; private $commitMode = self::COMMIT_DISABLE;
private $shouldAmend; private $shouldAmend;
@ -827,7 +829,7 @@ abstract class ArcanistBaseWorkflow {
$commit = head($api->getLocalCommitInformation()); $commit = head($api->getLocalCommitInformation());
$api->amendCommit($commit['message']); $api->amendCommit($commit['message']);
} else if ($api->supportsRelativeLocalCommits()) { } else if ($api->supportsRelativeLocalCommits()) {
$api->doCommit(''); $api->doCommit(self::AUTO_COMMIT_TITLE);
} }
} }
} }
@ -865,7 +867,7 @@ abstract class ArcanistBaseWorkflow {
$known_commits = $this->getConduit()->callMethodSynchronous( $known_commits = $this->getConduit()->callMethodSynchronous(
'diffusion.getcommits', 'diffusion.getcommits',
array('commits' => array('r'.$callsign.$commit['commit']))); array('commits' => array('r'.$callsign.$commit['commit'])));
if ($known_commits) { if (ifilter($known_commits, 'error', $negate = true)) {
return false; return false;
} }
} }

View file

@ -1933,6 +1933,9 @@ EOTEXT
$messages = array(); $messages = array();
foreach ($local as $hash => $info) { foreach ($local as $hash => $info) {
$text = $info['message']; $text = $info['message'];
if (trim($text) == self::AUTO_COMMIT_TITLE) {
continue;
}
$obj = ArcanistDifferentialCommitMessage::newFromRawCorpus($text); $obj = ArcanistDifferentialCommitMessage::newFromRawCorpus($text);
$messages[$hash] = $obj; $messages[$hash] = $obj;
} }
@ -2163,6 +2166,9 @@ EOTEXT
foreach ($usable as $message) { foreach ($usable as $message) {
// Pick the first line out of each message. // Pick the first line out of each message.
$text = trim($message); $text = trim($message);
if ($text == self::AUTO_COMMIT_TITLE) {
continue;
}
$text = head(explode("\n", $text)); $text = head(explode("\n", $text));
$default[] = ' - '.$text."\n"; $default[] = ' - '.$text."\n";
} }