]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix a bad interaction between "arc diff --reviewers" and "the first line of a message... master
authorepriestley <git@epriestley.com>
Thu, 5 Jan 2017 21:55:34 +0000 (13:55 -0800)
committerepriestley <git@epriestley.com>
Thu, 5 Jan 2017 22:35:39 +0000 (14:35 -0800)
Summary:
Fixes T12069. We implement "arc diff --reviewers" (and "--cc") by parsing a faux message with "Reviewers: ...".

After D17122, the first line of the message is always interpreted as a title, so the text ends up in the message body.

Instead, use a placeholder title so these fields are never initial fields.

Test Plan: Ran `arc diff --reviewers dog`, got only one "Reviewers" field.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12069

Differential Revision: https://secure.phabricator.com/D17147

src/workflow/ArcanistDiffWorkflow.php

index 7834f4b8ffabaefd9f081bd40289be6e4f7cceb2..c7f2ff0add1516a95b6c3b51dba98de735b7ad1a 100644 (file)
@@ -1962,7 +1962,13 @@ EOTEXT
       $faux_message[] = pht('CC: %s', $this->getArgument('cc'));
     }
 
+    // See T12069. After T10312, the first line of a message is always parsed
+    // as a title. Add a placeholder so "Reviewers" and "CC" are never the
+    // first line.
+    $placeholder_title = pht('<placeholder>');
+
     if ($faux_message) {
+      array_unshift($faux_message, $placeholder_title);
       $faux_message = implode("\n\n", $faux_message);
       $local = array(
         '(Flags)     ' => array(
@@ -2034,6 +2040,10 @@ EOTEXT
         continue;
       }
 
+      if ($title === $placeholder_title) {
+        continue;
+      }
+
       if (!isset($result['title'])) {
         // We don't have a title yet, so use this one.
         $result['title'] = $title;