Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2874966
D25358.1736968251.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25358.1736968251.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D25358: Let ArcanistBundle print some Git patch headers
Attached
Detach File
Event Timeline
Log In to Comment