Skip to content

Commit ae3be67

Browse files
committed
Pass branch sort order explicitly
1 parent be7faa3 commit ae3be67

12 files changed

Lines changed: 39 additions & 2 deletions

app/src/ui/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,6 +2281,7 @@ export class App extends React.Component<IAppProps, IAppState> {
22812281
askForConfirmationOnForcePush={
22822282
this.state.askForConfirmationOnForcePush
22832283
}
2284+
branchSortOrder={this.state.branchSortOrder}
22842285
accounts={this.state.accounts}
22852286
cachedRepoRulesets={this.state.cachedRepoRulesets}
22862287
openFileInExternalEditor={this.getOpenFileInExternalEditorHandler(
@@ -2523,6 +2524,7 @@ export class App extends React.Component<IAppProps, IAppState> {
25232524
externalEditorLabel={externalEditorLabel}
25242525
showSideBySideDiff={showSideBySideDiff}
25252526
currentBranchHasPullRequest={currentBranchHasPullRequest}
2527+
branchSortOrder={this.state.branchSortOrder}
25262528
onDismissed={onPopupDismissedFn}
25272529
onOpenInExternalEditor={this.onOpenInExternalEditor}
25282530
/>

app/src/ui/branches/branch-list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface IBranchListProps {
6161
/**
6262
* The sort order for branch lists in the current user preferences.
6363
*/
64-
readonly branchSortOrder?: BranchSortOrder
64+
readonly branchSortOrder: BranchSortOrder
6565

6666
/**
6767
* The currently selected branch in the list, see the onSelectionChanged prop.
@@ -184,7 +184,7 @@ export class BranchList extends React.Component<IBranchListProps> {
184184
this.props.allBranches,
185185
this.props.recentBranches,
186186
this.props.allWorktrees,
187-
this.props.branchSortOrder ?? BranchSortOrder.LastModified
187+
this.props.branchSortOrder
188188
)
189189
}
190190

app/src/ui/branches/branch-select.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Branch } from '../../models/branch'
44
import { ClickSource } from '../lib/list'
55
import { PopoverDropdown } from '../lib/popover-dropdown'
66
import { BranchList } from './branch-list'
7+
import { BranchSortOrder } from '../../models/branch-sort-order'
78
import {
89
getDefaultAriaLabelForBranch,
910
renderDefaultBranch,
@@ -37,6 +38,11 @@ interface IBranchSelectProps {
3738
*/
3839
readonly recentBranches: ReadonlyArray<Branch>
3940

41+
/**
42+
* The sort order for branch lists in the current user preferences.
43+
*/
44+
readonly branchSortOrder: BranchSortOrder
45+
4046
/** Called when the user changes the selected branch. */
4147
readonly onChange?: (branch: Branch) => void
4248

@@ -115,6 +121,7 @@ export class BranchSelect extends React.Component<
115121
allBranches={allBranches}
116122
currentBranch={currentBranch}
117123
defaultBranch={defaultBranch}
124+
branchSortOrder={this.props.branchSortOrder}
118125
recentBranches={recentBranches}
119126
allWorktrees={[]}
120127
filterText={filterText}

app/src/ui/multi-commit-operation/base-multi-commit-operation.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ import { PopupType } from '../../models/popup'
1515
import { Account } from '../../models/account'
1616
import { IAPIRepoRuleset } from '../../lib/api'
1717
import { Emoji } from '../../lib/emoji'
18+
import { BranchSortOrder } from '../../models/branch-sort-order'
1819

1920
export interface IMultiCommitOperationProps {
2021
readonly repository: Repository
2122
readonly dispatcher: Dispatcher
2223

24+
readonly branchSortOrder: BranchSortOrder
25+
2326
/** The current state of the multi commit operation */
2427
readonly state: IMultiCommitOperationState
2528

app/src/ui/multi-commit-operation/cherry-pick.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export abstract class CherryPick extends BaseMultiCommitOperation {
8080
<ChooseTargetBranchDialog
8181
key="choose-target-branch"
8282
repository={this.props.repository}
83+
branchSortOrder={this.props.branchSortOrder}
8384
allBranches={allBranches}
8485
defaultBranch={defaultBranch}
8586
recentBranches={recentBranches}

app/src/ui/multi-commit-operation/choose-branch/base-choose-branch-dialog.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Branch } from '../../../models/branch'
33
import { Repository } from '../../../models/repository'
44
import { IMatches } from '../../../lib/fuzzy-find'
55
import { Dialog, DialogContent, DialogFooter } from '../../dialog'
6+
import { BranchSortOrder } from '../../../models/branch-sort-order'
67
import {
78
BranchList,
89
IBranchListItem,
@@ -88,6 +89,9 @@ export interface IBaseChooseBranchDialogProps {
8889
*/
8990
readonly operation: MultiCommitOperationKind
9091

92+
/** The sort order for branch lists in the current user preferences. */
93+
readonly branchSortOrder: BranchSortOrder
94+
9195
/**
9296
* A function that's called when the dialog is dismissed by the user in the
9397
* ways described in the Dialog component's dismissable prop.
@@ -237,6 +241,7 @@ export class ChooseBranchDialog extends React.Component<
237241
defaultBranch={this.props.defaultBranch}
238242
recentBranches={this.props.recentBranches}
239243
allWorktrees={[]}
244+
branchSortOrder={this.props.branchSortOrder}
240245
filterText={this.state.filterText}
241246
onFilterTextChanged={this.onFilterTextChanged}
242247
selectedBranch={selectedBranch}

app/src/ui/multi-commit-operation/choose-branch/choose-target-branch.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import { ClickSource } from '../../lib/list'
1616
import { getDefaultAriaLabelForBranch } from '../../branches/branch-renderer'
1717
import { Repository } from '../../../models/repository'
18+
import { BranchSortOrder } from '../../../models/branch-sort-order'
1819

1920
interface IChooseTargetBranchDialogProps {
2021
readonly repository: Repository
@@ -59,6 +60,9 @@ interface IChooseTargetBranchDialogProps {
5960
* Call back to invoke create new branch dialog
6061
*/
6162
readonly onCreateNewBranch: (targetBranchName: string) => void
63+
64+
/** The sort order for branch lists in the current user preferences. */
65+
readonly branchSortOrder: BranchSortOrder
6266
}
6367

6468
interface IChooseTargetBranchDialogState {
@@ -191,6 +195,7 @@ export class ChooseTargetBranchDialog extends React.Component<
191195
defaultBranch={this.props.defaultBranch}
192196
recentBranches={this.props.recentBranches}
193197
allWorktrees={[]}
198+
branchSortOrder={this.props.branchSortOrder}
194199
filterText={this.state.filterText}
195200
onFilterTextChanged={this.onFilterTextChanged}
196201
onFilterListResultsChanged={this.onFilterListResultsChanged}

app/src/ui/multi-commit-operation/merge.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export abstract class Merge extends BaseMultiCommitOperation {
123123
? MultiCommitOperationKind.Squash
124124
: MultiCommitOperationKind.Merge
125125
}
126+
branchSortOrder={this.props.branchSortOrder}
126127
onDismissed={this.onFlowEnded}
127128
/>
128129
)

app/src/ui/multi-commit-operation/multi-commit-operation.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export class MultiCommitOperation extends React.Component<IMultiCommitOperationP
2929
askForConfirmationOnForcePush={
3030
this.props.askForConfirmationOnForcePush
3131
}
32+
branchSortOrder={this.props.branchSortOrder}
3233
accounts={this.props.accounts}
3334
cachedRepoRulesets={this.props.cachedRepoRulesets}
3435
openFileInExternalEditor={this.props.openFileInExternalEditor}
@@ -48,6 +49,7 @@ export class MultiCommitOperation extends React.Component<IMultiCommitOperationP
4849
askForConfirmationOnForcePush={
4950
this.props.askForConfirmationOnForcePush
5051
}
52+
branchSortOrder={this.props.branchSortOrder}
5153
accounts={this.props.accounts}
5254
cachedRepoRulesets={this.props.cachedRepoRulesets}
5355
openFileInExternalEditor={this.props.openFileInExternalEditor}
@@ -67,6 +69,7 @@ export class MultiCommitOperation extends React.Component<IMultiCommitOperationP
6769
askForConfirmationOnForcePush={
6870
this.props.askForConfirmationOnForcePush
6971
}
72+
branchSortOrder={this.props.branchSortOrder}
7073
accounts={this.props.accounts}
7174
cachedRepoRulesets={this.props.cachedRepoRulesets}
7275
openFileInExternalEditor={this.props.openFileInExternalEditor}

app/src/ui/multi-commit-operation/rebase.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export abstract class Rebase extends BaseRebase {
6363
currentBranch={currentBranch}
6464
initialBranch={initialBranch}
6565
operation={MultiCommitOperationKind.Rebase}
66+
branchSortOrder={this.props.branchSortOrder}
6667
onDismissed={this.onFlowEnded}
6768
/>
6869
)

0 commit comments

Comments
 (0)