Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14056934
D17122.id41185.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D17122.id41185.diff
View Options
diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php
--- a/src/applications/differential/parser/DifferentialCommitMessageParser.php
+++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php
@@ -161,17 +161,27 @@
$field_map = array();
foreach ($lines as $key => $line) {
- $match = null;
- if (preg_match($label_regexp, $line, $match)) {
- $lines[$key] = trim($match['text']);
- $field = $label_map[self::normalizeFieldLabel($match['field'])];
- if (!empty($seen[$field])) {
- $this->errors[] = pht(
- 'Field "%s" occurs twice in commit message!',
- $field);
- }
+ // We always parse the first line of the message as a title, even if it
+ // contains something we recognize as a field header.
+ if (!isset($seen[$key_title])) {
+ $field = $key_title;
+
+ $lines[$key] = trim($line);
$seen[$field] = true;
+ } else {
+ $match = null;
+ if (preg_match($label_regexp, $line, $match)) {
+ $lines[$key] = trim($match['text']);
+ $field = $label_map[self::normalizeFieldLabel($match['field'])];
+ if (!empty($seen[$field])) {
+ $this->errors[] = pht(
+ 'Field "%s" occurs twice in commit message!',
+ $match['field']);
+ }
+ $seen[$field] = true;
+ }
}
+
$field_map[$key] = $field;
}
diff --git a/src/applications/differential/parser/__tests__/messages/title-with-label.txt b/src/applications/differential/parser/__tests__/messages/title-with-label.txt
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/parser/__tests__/messages/title-with-label.txt
@@ -0,0 +1,11 @@
+color: orange
+~~~~~~~~~~
+{
+ "color": "color"
+}
+~~~~~~~~~~
+{
+ "title": "color: orange"
+}
+~~~~~~~~~~
+[]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 11:24 PM (1 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712644
Default Alt Text
D17122.id41185.diff (1 KB)
Attached To
Mode
D17122: Always parse the first line of a commit message as a title
Attached
Detach File
Event Timeline
Log In to Comment