@@ -182,6 +182,10 @@ import {
182182 defaultShowBranchNameInRepoListSetting ,
183183 ShowBranchNameInRepoListSetting ,
184184} from '../../models/show-branch-name-in-repo-list'
185+ import {
186+ BranchSortOrder ,
187+ DEFAULT_BRANCH_SORT_ORDER ,
188+ } from '../../models/branch-sort-order'
185189import { WorkflowPreferences } from '../../models/workflow-preferences'
186190import { TrashNameLabel } from '../../ui/lib/context-menu'
187191import { getDefaultDir } from '../../ui/lib/default-dir'
@@ -494,6 +498,7 @@ export const showDiffCheckMarksDefault = true
494498export const showDiffCheckMarksKey = 'diff-check-marks-visible'
495499
496500export const showBranchNameInRepoListKey = 'show-branch-name-in-repo-list'
501+ const branchSortOrderKey = 'branch-sort-order'
497502
498503const commitMessageGenerationDisclaimerLastSeenKey =
499504 'commit-message-generation-disclaimer-last-seen'
@@ -663,6 +668,8 @@ export class AppStore extends TypedBaseStore<IAppState> {
663668 private showBranchNameInRepoList : ShowBranchNameInRepoListSetting =
664669 defaultShowBranchNameInRepoListSetting
665670
671+ private branchSortOrder : BranchSortOrder = DEFAULT_BRANCH_SORT_ORDER
672+
666673 private cachedRepoRulesets = new Map < number , IAPIRepoRuleset > ( )
667674
668675 private underlineLinks : boolean = underlineLinksDefault
@@ -1212,6 +1219,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
12121219 underlineLinks : this . underlineLinks ,
12131220 showDiffCheckMarks : this . showDiffCheckMarks ,
12141221 showBranchNameInRepoList : this . showBranchNameInRepoList ,
1222+ branchSortOrder : this . branchSortOrder ,
12151223 updateState : updateStore . state ,
12161224 commitMessageGenerationDisclaimerLastSeen :
12171225 this . commitMessageGenerationDisclaimerLastSeen ,
@@ -2619,6 +2627,9 @@ export class AppStore extends TypedBaseStore<IAppState> {
26192627 getEnum ( showBranchNameInRepoListKey , ShowBranchNameInRepoListSetting ) ??
26202628 defaultShowBranchNameInRepoListSetting
26212629
2630+ this . branchSortOrder =
2631+ getEnum ( branchSortOrderKey , BranchSortOrder ) ?? DEFAULT_BRANCH_SORT_ORDER
2632+
26222633 this . commitMessageGenerationDisclaimerLastSeen =
26232634 getNumber ( commitMessageGenerationDisclaimerLastSeenKey ) ?? null
26242635
@@ -9202,6 +9213,14 @@ export class AppStore extends TypedBaseStore<IAppState> {
92029213 }
92039214 }
92049215
9216+ public _updateBranchSortOrder ( branchSortOrder : BranchSortOrder ) {
9217+ if ( branchSortOrder !== this . branchSortOrder ) {
9218+ this . branchSortOrder = branchSortOrder
9219+ localStorage . setItem ( branchSortOrderKey , branchSortOrder )
9220+ this . emitUpdate ( )
9221+ }
9222+ }
9223+
92059224 public _updateFileListFilter (
92069225 repository : Repository ,
92079226 filterUpdate : Partial < IFileListFilterState >
0 commit comments