Skip to content
Permalink
Browse files
[PrettyPatch] Support commit messages (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=240386
<rdar://problem/93248835>

Unreviewed follow-up fix.

* Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb: Handle diffs without a header.

Canonical link: https://commits.webkit.org/250606@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
JonWBedard committed May 16, 2022
1 parent a93c75f commit 6103a232a72839cc532cefa000d26cf41219fb1e
Showing 2 changed files with 13 additions and 2 deletions.
@@ -1,3 +1,13 @@
2022-05-16 Jonathan Bedard <jbedard@apple.com>

[PrettyPatch] Support commit messages (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=240386
<rdar://problem/93248835>

Unreviewed follow-up fix.

* PrettyPatch/PrettyPatch.rb: Handle diffs without a header.

2022-05-13 Jonathan Bedard <jbedard@apple.com>

[PrettyPatch] Support commit messages
@@ -797,6 +797,7 @@ def to_html
def self.parse(string)
commitMessageLength = 0
haveSeenDiffHeader = false
haveCommitMessage = false
subject = ''
linesForDiffs = []
line_array = string.lines.to_a
@@ -809,7 +810,7 @@ def self.parse(string)
haveSeenDiffHeader = false
elsif (PrettyPatch.message_header?(line))
haveSeenDiffHeader = false
parsingSubject = true
haveCommitMessage = true
commitMessageLength = 1
linesForDiffs << []
linesForDiffs.last << '+++ COMMIT_MESSAGE'
@@ -836,7 +837,7 @@ def self.parse(string)
if (subject.empty? && commitMessageLength != 0)
commitMessageLength += 1
linesForDiffs.last << '+' + line unless linesForDiffs.last.nil?
elsif (subject.empty? && haveSeenDiffHeader)
elsif (subject.empty? && (!haveCommitMessage || haveSeenDiffHeader))
linesForDiffs.last << line unless linesForDiffs.last.nil?
end
end

0 comments on commit 6103a23

Please sign in to comment.