mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
fix(dev-infra): preserve exact scope refs
This commit is contained in:
@@ -155,6 +155,20 @@ describe('change-scope', () => {
|
||||
expect(report.paths).toEqual({ committed: [], staged: [], unstaged: [], untracked: [] })
|
||||
})
|
||||
|
||||
it('preserves legal Unicode edge whitespace in branch and upstream names', () => {
|
||||
const { root } = fixture()
|
||||
const branch = '\u00a0topic\u3000'
|
||||
const upstreamBranch = '\u3000upstream\u00a0'
|
||||
git(root, ['switch', '-c', branch])
|
||||
git(root, ['push', 'origin', `HEAD:refs/heads/${upstreamBranch}`])
|
||||
git(root, ['branch', '--set-upstream-to', `origin/${upstreamBranch}`])
|
||||
|
||||
const report = jsonReport(root, 'origin/master')
|
||||
|
||||
expect(report.repository.branch).toBe(branch)
|
||||
expect(report.repository.upstream).toBe(`origin/${upstreamBranch}`)
|
||||
})
|
||||
|
||||
it('reports an exact head above a non-master stacked base while dirty paths remain worktree-local', () => {
|
||||
const { root } = fixture()
|
||||
git(root, ['switch', '-c', 'foundation'])
|
||||
|
||||
@@ -153,16 +153,16 @@ function currentBranch(root: string): string | null {
|
||||
const result = executeGit(root, ['symbolic-ref', '--quiet', '--short', 'HEAD'])
|
||||
if (result.status === 1) return null
|
||||
if (result.status !== 0) throw new Error(`cannot inspect the current branch: ${failureDetail(result)}`)
|
||||
return result.stdout.trim()
|
||||
return stripGitLineTerminator(result.stdout)
|
||||
}
|
||||
|
||||
function configuredUpstream(root: string, branch: string | null): string | null {
|
||||
if (branch === null) return null
|
||||
const output = requireGit(
|
||||
const output = stripGitLineTerminator(requireGit(
|
||||
root,
|
||||
['for-each-ref', '--count=1', '--format=%(upstream:short)', `refs/heads/${branch}`],
|
||||
'cannot inspect the configured upstream',
|
||||
).trim()
|
||||
))
|
||||
return output === '' ? null : output
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user