diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-01 05:55:30 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-01 05:55:30 +0000 |
commit | 1d74a161eb7aa593a71d9cfb51247da125048cb3 (patch) | |
tree | 421ed59d9ff179f2a019b72c196574326f6bfd74 /tool/change_maker.rb | |
parent | da9e87d69e7221d2e002c2e73ad9daa4440ef783 (diff) | |
download | ruby-1d74a161eb7aa593a71d9cfb51247da125048cb3.tar.gz |
improve git repository detection
* configure.in (AC_CONFIG_FILES): $srcdir/.git can be a file pointing
the real git_dir, such as when the git working tree is a "linked
working tree" (a working tree created by git-worktree). So use
git-rev-parse --git-dir to check if $srcdir is the top-level of a git
repository, not just checking if the $srcdir/.git directory does exist
or not. [ruby-core:74759] [Bug #12239]
* tool/change_maker.rb: use tool/vcs.rb to detect VCS. This used to have
its own VCS detection code, while we have tool/vcs.rb.
* tool/vcs.rb (detect): remove code duplication
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/change_maker.rb')
-rwxr-xr-x | tool/change_maker.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tool/change_maker.rb b/tool/change_maker.rb index 2bbc275d93..f7b7650a51 100755 --- a/tool/change_maker.rb +++ b/tool/change_maker.rb @@ -1,5 +1,8 @@ #! ./miniruby +$:.unshift(File.expand_path("../../lib", __FILE__)) +require File.expand_path("../vcs", __FILE__) + def diff2index(cmd, *argv) lines = [] path = nil @@ -22,10 +25,17 @@ def diff2index(cmd, *argv) lines.empty? ? nil : lines end -if `svnversion` =~ /^\d+/ +vcs = begin + VCS.detect(".") +rescue VCS::NotFoundError + nil +end + +case vcs +when VCS::SVN cmd = "svn diff --diff-cmd=diff -x-pU0" change = diff2index(cmd, ARGV) -elsif File.directory?(".git") +when VCS::GIT cmd = "git diff -U0" change = diff2index(cmd, ARGV) || diff2index(cmd, "--cached", ARGV) else |