⚡ perf(vscode): 摘修复只比对发布分支多出来的提交

This commit is contained in:
cruldra committed 2026-09-01 20:07:27 +08:00
1 parent b5b2bda353
commit dd3b7aaa24
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -245,13 +245,13 @@ async function commitFileChangeKeys(cwd: string, sha: string): Promise<string[]>
}
/** 发布分支上每个文件已有的改动指纹。用来认出「一次提交被拆成多次摘过去」的情况。 */
async function releaseFileChangeKeys(cwd: string, current: string, files: Set<string>): Promise<Set<string>> {
async function releaseFileChangeKeys(cwd: string, current: string, devBranch: string, files: Set<string>): Promise<Set<string>> {
const keys = new Set<string>()
if (files.size === 0)
return keys
const log = await mustGit(
cwd,
['log', '--no-merges', '--name-only', '--format=%n%H', `origin/${current}`],
['log', '--no-merges', '--name-only', '--format=%n%H', `origin/${devBranch}..origin/${current}`],
'读取发布分支改动失败',
)
let sha = ''
@@ -298,7 +298,7 @@ export async function listUnreleasedCommits(o: { cwd: string, devBranch: string,
for (const key of keys)
files.add(key.slice(0, key.indexOf('\0')))
}
const released = await releaseFileChangeKeys(o.cwd, o.current, files)
const released = await releaseFileChangeKeys(o.cwd, o.current, o.devBranch, files)
return commits.filter((c) => {
const keys = perCommitKeys.get(c.sha) ?? []
return keys.length === 0 || keys.some(k => !released.has(k))