Files
orca/src/shared/git-status-sort.ts
T
Kelvin Amoaba 6c2423d25d fix(mobile): list Source Control changes with desktop's sections, order and row rules (#34017)
* fix(mobile): list Source Control changes with desktop's sections, sort and row rules

Conflicts get their own section in the user's group order, submodule rows lose stage and
discard like desktop, paths sort with the shared collator, and review notes go out as desktop formats them.

* fix(mobile): read the group order the host now publishes and keep submodule rows read-only

The host's paired settings projection now carries sourceControlGroupOrder, the
normalized status projection keeps submodule metadata, and conflict rows reuse the
shared conflict-kind labels.

* refactor(mobile): share Source Control grouping and row rules with desktop

Desktop and mobile group rows through one shared helper, mobile's unstage button
follows desktop's rule, and the group order resets when the host changes.
2026-10-27 04:14:56 +00:00

18 lines
591 B
TypeScript

import type { GitStatusEntry } from './git-status-types'
import { compareFileNames } from './file-name-sort'
export function compareGitStatusEntries(a: GitStatusEntry, b: GitStatusEntry): number {
// Use compareFileNames to break numeric ties (2/02) consistently with File Explorer.
return getConflictSortRank(a) - getConflictSortRank(b) || compareFileNames(a.path, b.path)
}
function getConflictSortRank(entry: GitStatusEntry): number {
if (entry.conflictStatus === 'unresolved') {
return 0
}
if (entry.conflictStatus === 'resolved_locally') {
return 1
}
return 2
}