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
Родитель 2f0f9115d3
Коммит 474af9ee9a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

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