зеркало из https://github.com/github/ruby.git
Special treat when the first line ends with a dot [ci skip]
This commit is contained in:
Родитель
465bc682a2
Коммит
94bcae1b2a
|
@ -449,7 +449,11 @@ module SyncDefaultGems
|
||||||
log.delete!("\r")
|
log.delete!("\r")
|
||||||
log << "\n" if !log.end_with?("\n")
|
log << "\n" if !log.end_with?("\n")
|
||||||
repo_url = "https://github.com/#{repo}"
|
repo_url = "https://github.com/#{repo}"
|
||||||
subject, log = log.split(/\n(?:[ \t]*(?:\n|\z))/, 2)
|
|
||||||
|
# Split the subject from the log message according to git conventions.
|
||||||
|
# SPECIAL TREAT: when the first line ends with a dot `.` (which is not
|
||||||
|
# obeying the conventions too), takes only that line.
|
||||||
|
subject, log = log.split(/\A.+\.\K\n(?=\S)|\n(?:[ \t]*(?:\n|\z))/, 2)
|
||||||
conv = proc do |s|
|
conv = proc do |s|
|
||||||
mod = true if s.gsub!(/\b(?:(?i:fix(?:e[sd])?|close[sd]?|resolve[sd]?) +)\K#(?=\d+\b)|\bGH-#?(?=\d+\b)|\(\K#(?=\d+\))/) {
|
mod = true if s.gsub!(/\b(?:(?i:fix(?:e[sd])?|close[sd]?|resolve[sd]?) +)\K#(?=\d+\b)|\bGH-#?(?=\d+\b)|\(\K#(?=\d+\))/) {
|
||||||
"#{repo_url}/pull/"
|
"#{repo_url}/pull/"
|
||||||
|
|
|
@ -73,6 +73,15 @@ module Test_SyncDefaultGems
|
||||||
]
|
]
|
||||||
assert_message_filter(expected, trailers, [expected, "", trailers].join("\n"))
|
assert_message_filter(expected, trailers, [expected, "", trailers].join("\n"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_dot_ending_subject
|
||||||
|
expected = [
|
||||||
|
"subject with a dot.",
|
||||||
|
"",
|
||||||
|
"- next body line",
|
||||||
|
]
|
||||||
|
assert_message_filter(expected, nil, [expected[0], expected[2], ""].join("\n"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestSyncWithCommits < Test::Unit::TestCase
|
class TestSyncWithCommits < Test::Unit::TestCase
|
||||||
|
|
Загрузка…
Ссылка в новой задаче