summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-24 16:16:47 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-25 18:33:31 +0900
commit7fe22152fc28084f4395fece84ff6e5eb2d6b288 (patch)
treea85c5ab1201d5aa596d03808c9c4a5c7672406f3
parent5411fb8cffc6a2112b07243c7f4a4a87702f2af0 (diff)
[ruby/rdoc] Support other date formats in git-log
https://github.com/ruby/rdoc/commit/ad8cf37d72
-rw-r--r--lib/rdoc/parser/changelog.rb6
-rw-r--r--test/rdoc/test_rdoc_parser_changelog.rb22
2 files changed, 25 insertions, 3 deletions
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb
index 9ef7678875..25123492cc 100644
--- a/lib/rdoc/parser/changelog.rb
+++ b/lib/rdoc/parser/changelog.rb
@@ -231,13 +231,13 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
# date = header["CommitDate"] || header["Date"]
date = header[/^ *(?:Author)?Date: +(.*)/, 1]
author = header[/^ *Author: +(.*)/, 1]
- if /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+) *([-+]\d\d)(\d\d)/ =~
- (header[/^ *CommitDate: +(.*)/, 1] || date)
- time = Time.new($1, $2, $3, $4, $5, $6, "#{$7}:#{$8}")
+ begin
+ time = parse_date(header[/^ *CommitDate: +(.*)/, 1] || date)
@time_cache[entry_name] = time
author.sub!(/\s*<(.*)>/, '')
email = $1
entries << [entry_name, [author, email, date, entry_body]]
+ rescue ArgumentError
end
end
diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb
index eb1b5d4218..1476cf5dde 100644
--- a/test/rdoc/test_rdoc_parser_changelog.rb
+++ b/test/rdoc/test_rdoc_parser_changelog.rb
@@ -331,6 +331,18 @@ Mon Dec 3 20:37:22 2012 Koichi Sasada <ko1@atdot.net>
def test_scan_git
parser = util_parser <<-ChangeLog
+commit\ 38816887962ec167ee46acf500f68df5c3013163
+Author: git <svn-admin@ruby-lang.org>
+Date: Sun Jan 24 14:35:51 2021 +0900
+
+ * 2021-01-24 [ci skip]
+
+commit\ db7d0b89f6eca66cc7eb155c95f9123133da1ffc
+Author: git <svn-admin@ruby-lang.org>
+Date: Sat, 23 Jan 2021 06:01:39 +0900
+
+ * 2021-01-23 [ci skip]
+
commit\ 709bed2afaee50e2ce803f87bf1ee8291bea41e3
Author: git <svn-admin@ruby-lang.org>
Date: 2021-01-21 01:03:52 +0900
@@ -372,6 +384,16 @@ ChangeLog
expected = doc(
head(1, File.basename(@tempfile.path)),
blank_line,
+ head(2, '2021-01-24'),
+ blank_line,
+ log_entry(nil, '38816887962ec167ee46',
+ 'git', 'svn-admin@ruby-lang.org', 'Sun Jan 24 14:35:51 2021 +0900',
+ [list(:BULLET, item(nil, para('2021-01-24 [ci skip]')))]),
+ head(2, '2021-01-23'),
+ blank_line,
+ log_entry(nil, 'db7d0b89f6eca66cc7eb',
+ 'git', 'svn-admin@ruby-lang.org', 'Sat, 23 Jan 2021 06:01:39 +0900',
+ [list(:BULLET, item(nil, para('2021-01-23 [ci skip]')))]),
head(2, '2021-01-21'),
blank_line,
log_entry(nil, '709bed2afaee50e2ce80',