Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

fix(git): preserve commas in legacy history decorations (#35658)

OrcaWinae8b0c7cbc10
diff --git a/src/shared/git-history-log-parser.ts b/src/shared/git-history-log-parser.ts
index 9ae08d6609c..22e648f0d97 100644
--- a/src/shared/git-history-log-parser.ts
+++ b/src/shared/git-history-log-parser.ts
@@ -2,7 +2,7 @@ import type { GitHistoryItem, GitHistoryItemRef } from './git-history-types'
import { iterateNulDelimitedFields } from './nul-delimited-fields'
const GIT_HISTORY_DECORATION_SEPARATOR = '\x1f'
-const GIT_HISTORY_LEGACY_DECORATION_SEPARATOR = ','
+const GIT_HISTORY_LEGACY_DECORATION_SEPARATOR = ', '
// Git <2.43 echoes %(decorate:...) with exit 0, requiring %D fallback. Both need --decorate=full for parseable refs.
export const GIT_HISTORY_COMMIT_FORMAT =
diff --git a/src/shared/git-history.test.ts b/src/shared/git-history.test.ts
index b3de54bd0a6..bae9eae4046 100644
--- a/src/shared/git-history.test.ts
+++ b/src/shared/git-history.test.ts
@@ -144,6 +144,27 @@ describe('git history parsing', () => {
])
})
+ it('preserves commas in legacy branch, remote, and tag decorations', () => {
+ const [item] = parseGitHistoryLog(
+ logRecord({
+ hash: HEAD_OID,
+ decorations: `%(decorate:prefix=,suffix=,separator=${DECORATION_SEPARATOR})`,
+ message: 'preserve legacy ref names',
+ legacyDecorations: [
+ 'HEAD -> refs/heads/feat,,one',
+ 'refs/remotes/origin/feat,one',
+ 'tag: refs/tags/v1,,0'
+ ].join(', ')
+ })
+ )
+
+ expect(item?.references?.map((ref) => [ref.id, ref.name, ref.category])).toEqual([
+ ['refs/heads/feat,,one', 'feat,,one', 'branches'],
+ ['refs/remotes/origin/feat,one', 'origin/feat,one', 'remote branches'],
+ ['refs/tags/v1,,0', 'v1,,0', 'tags']
+ ])
+ })
+
it('keeps a comma inside a lone decoration, which carries no separator', () => {
// Why: a lone decoration carries no separator, so sniffing for \x1f split it in two.
const stdout = logRecord({