feat(ui): Git 面板列表把 origin/master 标在它指向的提交上
列表只有本地历史,看不出哪条远端已经有了,也就判断不出本地领先几条。 ensureRepo 多返回 upstream(优先当前分支的 upstream,没配回退 origin/master), 列表渲染时给 id 相同的那条挂一枚 origin/master 徽章、行首加一条蓝竖线, 和 git log --decorate 一个意思。
This commit is contained in:
@@ -1931,6 +1931,11 @@ body.pv-max .pv-code { max-width: none; padding-left: 16px; padding-right: 16px;
|
||||
.vcs-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
|
||||
.vcs-item:hover { background: var(--surface); }
|
||||
.vcs-item .t { font-size: 13.5px; font-weight: 600; color: var(--ink); word-break: break-word; line-height: 1.45; }
|
||||
/* 远端分支(origin/master)指向的那条提交:标题后挂一枚小标签,一眼看出本地领先几条 */
|
||||
.vcs-up { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px;
|
||||
font: 600 10.5px/17px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
color: var(--fg-0550ae); background: var(--bg-dbeafe); vertical-align: 1px; }
|
||||
.vcs-item.at-up { box-shadow: inset 3px 0 0 var(--active); }
|
||||
.vcs-item .m { margin-top: 3px; font-size: 12px; color: var(--gray); }
|
||||
.vcs-item .m code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
|
||||
/* 「未提交的改动」入口:列表顶部单独一行,与提交行区分 */
|
||||
|
||||
@@ -64,9 +64,12 @@
|
||||
'<div class="t">未提交的改动</div>' +
|
||||
'<div class="m">' + st.worktree.files + ' 个文件有变动</div></div>');
|
||||
}
|
||||
const up = st.repo && st.repo.upstream;
|
||||
for (const c of st.commits) {
|
||||
parts.push('<div class="vcs-item" data-act="commit" data-id="' + esc(c.id) + '">' +
|
||||
'<div class="t">' + esc(c.subject) + '</div>' +
|
||||
const atUp = up && c.id === up.id;
|
||||
parts.push('<div class="vcs-item' + (atUp ? ' at-up' : '') + '" data-act="commit" data-id="' + esc(c.id) + '">' +
|
||||
'<div class="t">' + esc(c.subject) +
|
||||
(atUp ? ' <span class="vcs-up" title="远端 ' + esc(up.ref) + ' 指向这里">' + esc(up.ref) + '</span>' : '') + '</div>' +
|
||||
'<div class="m">' + esc(c.author) + ' · ' + esc(fmtTime(c.time)) + ' · ' + esc(c.short) + '</div></div>');
|
||||
}
|
||||
if (!st.commits.length && !(st.worktree && st.worktree.files)) {
|
||||
|
||||
Reference in New Issue
Block a user