summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-01 20:47:00 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-01 20:47:00 +0900
commit474af9ee9a4804d052e1e40503e1b6491d00a969 (patch)
tree17c372ab3a21d70385904524e56bd840cbcee5af /tool/vcs.rb
parent2f0f9115d314d0fecbd0a9f5b5a6c59c611fa5e7 (diff)
No last commit when up-to-date
Get the last commit title from the upstream to the head, so that no `last_commit` line will be shown when the branch is up to date with the upstream.
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb
index f4a10c8..f85b57e 100644
--- a/tool/vcs.rb
+++ b/tool/vcs.rb
@@ -402,7 +402,9 @@ class VCS
modified = log[/^Date:\s+(.*)/, 1]
branch = cmd_read_at(srcdir, [gitcmd + %W[symbolic-ref --short HEAD]])
branch.chomp!
- title = cmd_read_at(srcdir, [gitcmd + %W[log --format=%s -n1 FETCH_HEAD..HEAD]])
+ 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 = nil if title.empty?
[last, changed, modified, branch, title]
end