Skip to content

Commit 3103d97

Browse files
committed
fix: fix 1 file changd summary
1 parent 79e394e commit 3103d97

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/git/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ export const useGitService = createSingletonComposable(() => {
9090

9191
let logResult: ExtendedLogResult
9292
try {
93-
// 用 simple-git 的 raw 获取原始 log 输出,logArgs 前加 'log'
9493
const rawLog = await git.raw(['log', ...logArgs])
95-
// 先用 \n 分割,再聚合每个 commit 块
9694
const lines = rawLog.split('\n')
9795

9896
const commitsRaw: string[] = []
@@ -130,7 +128,7 @@ export const useGitService = createSingletonComposable(() => {
130128
return match ? { status: match[1], path: match[2] } : null
131129
}).filter(Boolean)
132130
// 统计 summary 行
133-
const summaryLine = lines.find(l => /files changed/.test(l))
131+
const summaryLine = lines.find(l => /files? changed/.test(l))
134132
if (summaryLine) {
135133
summary = summaryLine.trim()
136134
// 解析数字

src/views/diff/entity/FileNode.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export class FileNode extends TreeItem {
88
public readonly commitHash: string,
99
public readonly oldPath?: string,
1010
) {
11-
// 为重命名的文件创建特殊的 URI
1211
const params = new URLSearchParams()
1312
params.set('status', status)
1413
if (oldPath) {
@@ -19,8 +18,8 @@ export class FileNode extends TreeItem {
1918
super(uri, TreeItemCollapsibleState.None)
2019

2120
this.tooltip = oldPath
22-
? `${status} ${oldPath}${path}`
23-
: `${status} ${path}`
21+
? `${oldPath}${path}`
22+
: `${path}`
2423

2524
this.command = {
2625
command: `${EXTENSION_SYMBOL}.openDiff`,

0 commit comments

Comments
 (0)