1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Nobuyoshi Nakada 2019-05-01 20:47:00 +09:00
parent 2f0f9115d3
commit 474af9ee9a
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -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