1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Takashi Kokubun 2019-06-05 20:07:19 +09:00
parent 84c294eb0b
commit f3c877e8de
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -399,7 +399,7 @@ class VCS
end end
def self.cmd_read_at(srcdir, cmds) def self.cmd_read_at(srcdir, cmds)
IO.pread(*cmd_args(cmds, srcdir)) without_gitconfig { IO.pread(*cmd_args(cmds, srcdir)) }
end end
def self.get_revisions(path, srcdir = nil) def self.get_revisions(path, srcdir = nil)
@ -444,6 +444,13 @@ class VCS
rev[0, 10] rev[0, 10]
end end
def self.without_gitconfig
home = ENV.delete('HOME')
yield
ensure
ENV['HOME'] = home if home
end
def initialize(*) def initialize(*)
super super
if srcdir = @srcdir and self.class.local_path?(srcdir) if srcdir = @srcdir and self.class.local_path?(srcdir)