]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't use empty commit message in commit from `arc diff`
authorvrana <jakubv@fb.com>
Mon, 19 Nov 2012 22:14:38 +0000 (14:14 -0800)
committervrana <jakubv@fb.com>
Tue, 20 Nov 2012 18:58:22 +0000 (10:58 -0800)
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

src/workflow/ArcanistBaseWorkflow.php
src/workflow/ArcanistDiffWorkflow.php

index 3e9ade257aa95125bd87ca2cf15f8b11e30c45af..1b9cccd1bb7ec0d79f8c2bd412ef18795fbb55e9 100644 (file)
@@ -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;
         }
       }
index aefe6fc54fe07f6af99e2110e3e7420b04878e68..6f09a6c770a2cc9a7cd98c7a9884c456263ec941 100644 (file)
@@ -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";
     }