From f3c877e8deaea91ff27c0fca837c9388d030a896 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 5 Jun 2019 20:07:19 +0900 Subject: [PATCH] Ignore ~/.gitconfig on tool/vcs.rb git commands Because some `log.*` git configs may change the result of `git log`, `RUBY_LAST_COMMIT_TITLE` can be wrongly formatted and break version.c compilation. So the `git log` executions should not respect user's gitconfig. --- tool/vcs.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tool/vcs.rb b/tool/vcs.rb index 618a788dc7..86e7e50f0c 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -399,7 +399,7 @@ class VCS end def self.cmd_read_at(srcdir, cmds) - IO.pread(*cmd_args(cmds, srcdir)) + without_gitconfig { IO.pread(*cmd_args(cmds, srcdir)) } end def self.get_revisions(path, srcdir = nil) @@ -444,6 +444,13 @@ class VCS rev[0, 10] end + def self.without_gitconfig + home = ENV.delete('HOME') + yield + ensure + ENV['HOME'] = home if home + end + def initialize(*) super if srcdir = @srcdir and self.class.local_path?(srcdir)