Page MenuHomePhorge

D25358.1736968251.diff
No OneTemporary

D25358.1736968251.diff

diff --git a/src/parser/ArcanistBundle.php b/src/parser/ArcanistBundle.php
--- a/src/parser/ArcanistBundle.php
+++ b/src/parser/ArcanistBundle.php
@@ -15,6 +15,8 @@
private $loadFileDataCallback;
private $authorName;
private $authorEmail;
+ private $subject;
+ private $dateString;
private $byteLimit;
private $reservedBytes;
@@ -59,6 +61,25 @@
return $full_author;
}
+ public function setSubject($subject) {
+ $this->subject = $subject;
+ return $this;
+ }
+
+ public function getSubject() {
+ return $this->subject;
+ }
+
+ public function setDateString($date_string) {
+ $this->dateString = $date_string;
+ return $this;
+ }
+
+ public function getDateString() {
+ return $this->dateString;
+ }
+
+
public function setConduit(ConduitClient $conduit) {
$this->conduit = $conduit;
return $this;
@@ -318,6 +339,8 @@
$result = array();
$changes = $this->getChanges();
+ $result[] = $this->buildGitPatchHeader();
+
$binary_sources = array();
foreach ($changes as $change) {
if (!$this->isGitBinaryChange($change)) {
@@ -484,6 +507,37 @@
return $this->convertNonUTF8Diff($diff);
}
+ private function buildGitPatchHeader() {
+ $header = array();
+
+ // Not using pht() here, because this is is read by a machine (git am).
+
+ if ($this->getFullAuthor() !== null) {
+ $header[] = 'From: '.$this->getFullAuthor();
+ }
+
+ if (phutil_nonempty_string($this->getDateString())) {
+ $header[] = 'Date: '.$this->getDateString();
+ }
+
+ if (phutil_nonempty_string($this->getSubject())) {
+ $header[] = 'Subject: '.$this->getSubject();
+ }
+
+ if (!$header) {
+ return null;
+ }
+
+ $eol = $this->getEOL('git');
+ foreach ($header as $i => $value) {
+ // minimal sanitation
+ $header[$i] = str_replace($eol, ' ', $value);
+ }
+
+ $header[] = $eol;
+ return implode($eol, $header);
+ }
+
private function isGitBinaryChange(ArcanistDiffChange $change) {
$file_type = $change->getFileType();
return ($file_type == ArcanistDiffChangeType::FILE_BINARY ||
diff --git a/src/workflow/ArcanistExportWorkflow.php b/src/workflow/ArcanistExportWorkflow.php
--- a/src/workflow/ArcanistExportWorkflow.php
+++ b/src/workflow/ArcanistExportWorkflow.php
@@ -203,7 +203,7 @@
$author = sprintf('%s <%s>',
$author_dict['realName'],
- $email);
+ trim($email));
} else if ($repository_api instanceof ArcanistMercurialAPI) {
$this->parseBaseCommitArgument($this->getArgument('paths'));
$diff = $repository_api->getFullMercurialDiff();

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 15, 19:10 (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116197
Default Alt Text
D25358.1736968251.diff (2 KB)

Event Timeline