aboutsummaryrefslogtreecommitdiffstats
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-18 03:43:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-18 03:43:01 +0000
commit7d9f497f7ebde95ba2e15247ab55021872a7009b (patch)
treeb61228fee4b99f901f3971d60b4dc44f61e45641 /tool/vcs.rb
parent802d71a57e39251a8f18685367508d405c7f798b (diff)
downloadruby-7d9f497f7ebde95ba2e15247ab55021872a7009b.tar.gz
vcs.rb: refactor
* tool/vcs.rb (VCS::GIT.get_revisions): refactor git -C option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 21ea316166..1e087b6542 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -254,8 +254,9 @@ class VCS
register(".git")
def self.get_revisions(path, srcdir = nil)
- logcmd = %W[git log -n1 --date=iso]
- logcmd[1, 0] = ["-C", srcdir] if srcdir
+ gitcmd = %W[git]
+ gitcmd.push("-C", srcdir) if srcdir
+ logcmd = gitcmd + %W[log -n1 --date=iso]
logcmd << "--grep=^ *git-svn-id: .*@[0-9][0-9]*"
idpat = /git-svn-id: .*?@(\d+) \S+\Z/
log = IO.pread(logcmd)
@@ -269,10 +270,7 @@ class VCS
changed = last
end
modified = log[/^Date:\s+(.*)/, 1]
- cmd = %W[git]
- cmd.push("-C", srcdir) if srcdir
- cmd.push("symbolic-ref", "HEAD")
- branch = IO.pread(cmd)[%r'\A(?:refs/heads/)?(.+)', 1]
+ branch = IO.pread(gitcmd + %W[symbolic-ref HEAD])[%r'\A(?:refs/heads/)?(.+)', 1]
[last, changed, modified, branch]
end