]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use verbatim commit message if it couldn't be parsed
authorvrana <jakubv@fb.com>
Tue, 12 Jun 2012 20:29:05 +0000 (13:29 -0700)
committervrana <jakubv@fb.com>
Wed, 13 Jun 2012 00:30:13 +0000 (17:30 -0700)
Summary:
We currently remove an invalid user from Reviewers and similar fields and print a note in the template. There are several problems:

# If I only made a typo in the name then it takes some effort to fix this typo and put the name on the original place (this information is lost).
# The notice is almost invisible and most users will just confirm the message without noticing it.
# If I fill the data in the commit message (and not in the template) then I probably want to treat that as authoritative so I want it to be correct.

Test Plan:
`arc diff` with invalid reviewer in commit message.
`arc diff` on empty commit message.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, nh
Differential Revision: https://secure.phabricator.com/D2730

src/workflow/ArcanistDiffWorkflow.php

index 14c5222f59dd48f0794e44aea756f07832b174e0..28f4bdd95cae32d53766f2a77f52c1d60a5a04d1 100644 (file)
@@ -1339,13 +1339,18 @@ EOTEXT
         $template_is_default = true;
       }
 
-      $template = $conduit->callMethodSynchronous(
-        'differential.getcommitmessage',
-        array(
-          'revision_id' => null,
-          'edit'        => 'create',
-          'fields'      => $fields,
-        ));
+      if ($notes) {
+        $commit = head($this->getRepositoryAPI()->getLocalCommitInformation());
+        $template = $commit['message'];
+      } else {
+        $template = $conduit->callMethodSynchronous(
+          'differential.getcommitmessage',
+          array(
+            'revision_id' => null,
+            'edit'        => 'create',
+            'fields'      => $fields,
+          ));
+      }
     }
 
     if ($included) {