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

ruby-changes:57463

From: Nobuyoshi <ko1@a...>
Date: Sun, 1 Sep 2019 23:23:34 +0900 (JST)
Subject: [ruby-changes:57463] Nobuyoshi Nakada: ff7c95dfd9 (master): Support git tags

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

From ff7c95dfd9b6aa1b4a83c18172e2845f7e6a4e7f Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 1 Sep 2019 18:10:50 +0900
Subject: Support git tags


diff --git a/tool/lib/vcs.rb b/tool/lib/vcs.rb
index 8896c34..622e558 100644
--- a/tool/lib/vcs.rb
+++ b/tool/lib/vcs.rb
@@ -457,8 +457,9 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L457
     end
 
     def _get_revisions(path, srcdir = nil)
+      ref = Branch === path ? path.to_str : 'HEAD'
       gitcmd = [COMMAND]
-      last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', 'HEAD']]).rstrip
+      last = cmd_read_at(srcdir, [[*gitcmd, 'rev-parse', ref]]).rstrip
       log = cmd_read_at(srcdir, [[*gitcmd, 'log', '-n1', '--date=iso', '--pretty=fuller', *path]])
       changed = log[/\Acommit (\h+)/, 1]
       modified = log[/^CommitDate:\s+(.*)/, 1]
@@ -470,9 +471,12 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L471
         end
         changed = rev
       end
-      branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref --short HEAD]])
+      branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref --short #{ref}]])
       if branch.empty?
-        branch_list = cmd_read_at(srcdir, [gitcmd + %W[branch --list --contains HEAD]]).lines.to_a
+        branch = cmd_read_at(srcdir, [gitcmd + %W[tag --list #{ref}]]).strip
+      end
+      if branch.empty?
+        branch_list = cmd_read_at(srcdir, [gitcmd + %W[branch --list --contains #{ref}]]).lines.to_a
         branch, = branch_list.grep(/\A\*/)
         case branch
         when /\A\* *\(\S+ detached at (.*)\)\Z/
@@ -493,7 +497,7 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/lib/vcs.rb#L497
       branch = ":detached:" if branch.empty?
       upstream = cmd_read_at(srcdir, [gitcmd + %W[branch --list --format=%(upstream:short) #{branch}]])
       upstream.chomp!
-      title = cmd_read_at(srcdir, [gitcmd + %W[log --format=%s -n1 #{upstream}..HEAD]])
+      title = cmd_read_at(srcdir, [gitcmd + %W[log --format=%s -n1 #{upstream}..#{ref}]])
       title = nil if title.empty?
       [last, changed, modified, branch, title]
     end
-- 
cgit v0.10.2


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

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