From 474af9ee9a4804d052e1e40503e1b6491d00a969 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 1 May 2019 20:47:00 +0900 Subject: 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. --- tool/vcs.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tool/vcs.rb b/tool/vcs.rb index f4a10c81f1..f85b57e3cf 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 -- cgit v1.2.3