summaryrefslogtreecommitdiff
path: root/tool/file2lastrev.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-03 12:26:23 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-03 12:54:33 +0900
commit3102ca4c6e0b8fa50f56a6a25d8a28c48251d1c6 (patch)
tree0a08b0353490ef8883ee12bac78ba24535c4abd7 /tool/file2lastrev.rb
parent17af8bfce6508951edca8650155be5525a894f65 (diff)
Default GIT external encoding to UTF-8 🤷‍♂️
And dump the title as US-ASCII.
Diffstat (limited to 'tool/file2lastrev.rb')
-rwxr-xr-xtool/file2lastrev.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 8a72bd3786..e22aa88b45 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -59,6 +59,9 @@ vcs = nil
when :revision_h
Proc.new {|last, changed, modified, branch, title|
short = vcs.short_revision(last)
+ if /[^\x00-\x7f]/ =~ title and title.respond_to?(:force_encoding)
+ title = title.dup.force_encoding("US-ASCII")
+ end
[
"#define RUBY_REVISION #{short.inspect}",
("#define RUBY_FULL_REVISION #{last.inspect}" unless short == last),