[前][次][番号順一覧][スレッド一覧]

ruby-changes:55965

From: Nobuyoshi <ko1@a...>
Date: Mon, 3 Jun 2019 12:55:05 +0900 (JST)
Subject: [ruby-changes:55965] Nobuyoshi Nakada: 3102ca4c6e (trunk): Default GIT external encoding to UTF-8 ♂

https://git.ruby-lang.org/ruby.git/commit/?id=3102ca4c6e

From 3102ca4c6e0b8fa50f56a6a25d8a28c48251d1c6 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 3 Jun 2019 12:26:23 +0900
Subject: =?UTF-8?q?Default=20GIT=20external=20encoding=20to=20UTF-8=20?=
 =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=82=EF=B8=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

And dump the title as US-ASCII.

diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 8a72bd3..e22aa88 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -59,6 +59,9 @@ vcs = nil https://github.com/ruby/ruby/blob/trunk/tool/file2lastrev.rb#L59
   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),
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 56924ff..6c67b9b 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -32,6 +32,7 @@ if RUBY_VERSION < "2.0" https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L32
         if opts.kind_of?(Hash)
           dir = opts.delete(:chdir)
           rest.pop if opts.empty?
+          opts.delete(:external_encoding)
         end
 
         if block
@@ -66,6 +67,7 @@ if RUBY_VERSION < "2.0" https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L67
         if opts.kind_of?(Hash)
           dir = opts.delete(:chdir)
           rest.pop if opts.empty?
+          opts.delete(:external_encoding)
         end
 
         command = command.shelljoin if Array === command
@@ -384,8 +386,9 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L386
     COMMAND = ENV["GIT"] || 'git'
 
     def self.cmd_args(cmds, srcdir = nil)
+      (opts = cmds.last).kind_of?(Hash) or cmds << (opts = {})
+      opts[:external_encoding] ||= "UTF-8"
       if srcdir and local_path?(srcdir)
-        (opts = cmds.last).kind_of?(Hash) or cmds << (opts = {})
         opts[:chdir] ||= srcdir
       end
       cmds
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]