Skip to content

Commit 428ef93

Browse files
committed
Rename "Delete all local branches" to "Delete unused local branches"
Only branches that are not checked out will get deleted, so it makes more sense to name it "Delete unused local branches"
1 parent 3fbdc74 commit 428ef93

10 files changed

Lines changed: 42 additions & 40 deletions

File tree

app/src/models/popup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { WorktreeEntry } from './worktree'
3232
export enum PopupType {
3333
RenameBranch = 'RenameBranch',
3434
DeleteBranch = 'DeleteBranch',
35-
DeleteAllLocalBranches = 'DeleteAllLocalBranches',
35+
DeleteUnusedLocalBranches = 'DeleteUnusedLocalBranches',
3636
DeleteRemoteBranch = 'DeleteRemoteBranch',
3737
ConfirmDiscardChanges = 'ConfirmDiscardChanges',
3838
Preferences = 'Preferences',
@@ -160,7 +160,7 @@ export type PopupDetail =
160160
existsOnRemote: boolean
161161
}
162162
| {
163-
type: PopupType.DeleteAllLocalBranches
163+
type: PopupType.DeleteUnusedLocalBranches
164164
repository: Repository
165165
branches: ReadonlyArray<Branch>
166166
}

app/src/ui/app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
CantDeleteCurrentBranch,
5252
CantDeleteCurrentBranchUncommittedChanges,
5353
DeleteBranch,
54-
DeleteAllLocalBranches,
54+
DeleteUnusedLocalBranches,
5555
DeleteRemoteBranch,
5656
} from './delete-branch'
5757
import { CantDeleteMainBranch } from './delete-branch/cant-delete-main-branch'
@@ -1742,10 +1742,10 @@ export class App extends React.Component<IAppProps, IAppState> {
17421742
onDeleted={this.onBranchDeleted}
17431743
/>
17441744
)
1745-
case PopupType.DeleteAllLocalBranches:
1745+
case PopupType.DeleteUnusedLocalBranches:
17461746
return (
1747-
<DeleteAllLocalBranches
1748-
key="delete-all-local-branches"
1747+
<DeleteUnusedLocalBranches
1748+
key="delete-unused-local-branches"
17491749
dispatcher={this.props.dispatcher}
17501750
repository={popup.repository}
17511751
branches={popup.branches}

app/src/ui/branches/branch-list-item-context-menu.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface IBranchContextMenuConfig {
1212
onViewPullRequestOnGitHub?: () => void
1313
onSetAsDefaultBranch?: (branchName: string) => void
1414
onDeleteBranch?: (branchName: string) => void
15-
onDeleteAllLocalBranches?: () => void
15+
onDeleteUnusedLocalBranches?: () => void
1616
onPullSingleBranch?: (branchName: string) => void
1717
onCheckoutInNewWorktree?: (branch: Branch) => void
1818
}
@@ -28,7 +28,7 @@ export function generateBranchContextMenuItems(
2828
onViewPullRequestOnGitHub,
2929
onSetAsDefaultBranch,
3030
onDeleteBranch,
31-
onDeleteAllLocalBranches,
31+
onDeleteUnusedLocalBranches,
3232
onPullSingleBranch,
3333
onCheckoutInNewWorktree,
3434
} = config
@@ -94,12 +94,12 @@ export function generateBranchContextMenuItems(
9494
})
9595
}
9696

97-
if (onDeleteAllLocalBranches !== undefined) {
97+
if (onDeleteUnusedLocalBranches !== undefined) {
9898
items.push({
9999
label: __DARWIN__
100-
? 'Delete All Local Branches…'
101-
: 'Delete all local branches…',
102-
action: () => onDeleteAllLocalBranches(),
100+
? 'Delete Unused Local Branches…'
101+
: 'Delete unused local branches…',
102+
action: () => onDeleteUnusedLocalBranches(),
103103
})
104104
}
105105

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ interface IBranchListProps {
147147
readonly onDeleteBranch?: (branchName: string) => void
148148

149149
/**
150-
* Optional: Callback for if the "delete all local branches" context menu
150+
* Optional: Callback for if the "delete unused local branches" context menu
151151
* should exist. It is only shown when the right-clicked branch is local-only
152152
* and the repository has at least three local-only branches.
153153
*/
154-
readonly onDeleteAllLocalBranches?: () => void
154+
readonly onDeleteUnusedLocalBranches?: () => void
155155

156156
/** Optional: Callback to checkout a branch in a new worktree */
157157
readonly onCheckoutInNewWorktree?: (branch: Branch) => void
@@ -251,7 +251,7 @@ export class BranchList extends React.Component<IBranchListProps> {
251251
const {
252252
onRenameBranch,
253253
onDeleteBranch,
254-
onDeleteAllLocalBranches,
254+
onDeleteUnusedLocalBranches: onDeleteUnusedLocalBranches,
255255
onCheckoutInNewWorktree,
256256
onSetAsDefaultBranch,
257257
onPullSingleBranch,
@@ -268,12 +268,12 @@ export class BranchList extends React.Component<IBranchListProps> {
268268

269269
const { branch } = item
270270

271-
// Only offer "delete all local branches" when right-clicking a local-only
271+
// Only offer "delete unused local branches" when right-clicking a local-only
272272
// branch and the repository has at least three local-only branches.
273273
const localOnlyBranchCount =
274274
this.props.allBranches.filter(isLocalOnlyBranch).length
275-
const canDeleteAllLocalBranches =
276-
onDeleteAllLocalBranches !== undefined &&
275+
const canDeleteUnusedLocalBranches =
276+
onDeleteUnusedLocalBranches !== undefined &&
277277
isLocalOnlyBranch(branch) &&
278278
localOnlyBranchCount >= 3
279279

@@ -286,8 +286,8 @@ export class BranchList extends React.Component<IBranchListProps> {
286286
? undefined
287287
: onSetAsDefaultBranch,
288288
onDeleteBranch,
289-
onDeleteAllLocalBranches: canDeleteAllLocalBranches
290-
? onDeleteAllLocalBranches
289+
onDeleteUnusedLocalBranches: canDeleteUnusedLocalBranches
290+
? onDeleteUnusedLocalBranches
291291
: undefined,
292292
onPullSingleBranch,
293293
onCheckoutInNewWorktree,

app/src/ui/branches/branches-container.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ interface IBranchesContainerProps {
5454
readonly onRenameBranch: (branchName: string) => void
5555
readonly onSetAsDefaultBranch: (branchName: string) => void
5656
readonly onDeleteBranch: (branchName: string) => void
57-
readonly onDeleteAllLocalBranches: () => void
57+
readonly onDeleteUnusedLocalBranches: () => void
5858
readonly onCheckoutInNewWorktree?: (branch: Branch) => void
5959

6060
/** Optional callback to checkout a PR in a new worktree */
@@ -299,7 +299,7 @@ export class BranchesContainer extends React.Component<
299299
onRenameBranch={this.props.onRenameBranch}
300300
onSetAsDefaultBranch={this.props.onSetAsDefaultBranch}
301301
onDeleteBranch={this.props.onDeleteBranch}
302-
onDeleteAllLocalBranches={this.props.onDeleteAllLocalBranches}
302+
onDeleteUnusedLocalBranches={this.props.onDeleteUnusedLocalBranches}
303303
onPullSingleBranch={this.props.onPullSingleBranch}
304304
onCheckoutInNewWorktree={
305305
enableWorktreeSupport()

app/src/ui/delete-branch/delete-all-local-branches-dialog.tsx renamed to app/src/ui/delete-branch/delete-unused-local-branches-dialog.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import { Dialog, DialogContent, DialogFooter } from '../dialog'
77
import { Ref } from '../lib/ref'
88
import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group'
99

10-
interface IDeleteAllLocalBranchesProps {
10+
interface IDeleteUnusedLocalBranchesProps {
1111
readonly dispatcher: Dispatcher
1212
readonly repository: Repository
1313
readonly branches: ReadonlyArray<Branch>
1414
readonly onDismissed: () => void
1515
readonly onDeleted: (repository: Repository) => void
1616
}
1717

18-
interface IDeleteAllLocalBranchesState {
18+
interface IDeleteUnusedLocalBranchesState {
1919
readonly isDeleting: boolean
2020
}
2121

22-
export class DeleteAllLocalBranches extends React.Component<
23-
IDeleteAllLocalBranchesProps,
24-
IDeleteAllLocalBranchesState
22+
export class DeleteUnusedLocalBranches extends React.Component<
23+
IDeleteUnusedLocalBranchesProps,
24+
IDeleteUnusedLocalBranchesState
2525
> {
26-
public constructor(props: IDeleteAllLocalBranchesProps) {
26+
public constructor(props: IDeleteUnusedLocalBranchesProps) {
2727
super(props)
2828

2929
this.state = {
@@ -36,25 +36,27 @@ export class DeleteAllLocalBranches extends React.Component<
3636

3737
return (
3838
<Dialog
39-
id="delete-all-local-branches"
39+
id="delete-unused-local-branches"
4040
title={
41-
__DARWIN__ ? 'Delete All Local Branches' : 'Delete all local branches'
41+
__DARWIN__
42+
? 'Delete Unused Local Branches'
43+
: 'Delete unused local branches'
4244
}
4345
type="warning"
4446
onSubmit={this.deleteBranches}
4547
onDismissed={this.props.onDismissed}
4648
disabled={this.state.isDeleting}
4749
loading={this.state.isDeleting}
4850
role="alertdialog"
49-
ariaDescribedBy="delete-all-local-branches-message"
51+
ariaDescribedBy="delete-unused-local-branches-message"
5052
>
5153
<DialogContent>
52-
<div id="delete-all-local-branches-message">
54+
<div id="delete-unused-local-branches-message">
5355
<p>
5456
Delete the following {count}{' '}
5557
{count === 1 ? 'local branch' : 'local branches'}?
5658
</p>
57-
<ul className="delete-all-local-branches-list">
59+
<ul className="delete-unused-local-branches-list">
5860
{this.props.branches.map(branch => (
5961
<li key={branch.name}>
6062
<Ref>{branch.name}</Ref>

app/src/ui/delete-branch/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { DeleteBranch } from './delete-branch-dialog'
2-
export { DeleteAllLocalBranches } from './delete-all-local-branches-dialog'
2+
export { DeleteUnusedLocalBranches } from './delete-unused-local-branches-dialog'
33
export { DeleteRemoteBranch } from './delete-remote-branch-dialog'
44
export { CantDeleteCurrentBranch } from './cant-delete-current-branch-dialog'
55
export { CantDeleteCurrentBranchUncommittedChanges } from './cant-delete-current-branch-uncommitted-changes-dialog'

app/src/ui/toolbar/branch-dropdown.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
121121
branchSortOrder={this.props.branchSortOrder}
122122
emoji={this.props.emoji}
123123
onDeleteBranch={this.onDeleteBranch}
124-
onDeleteAllLocalBranches={this.onDeleteAllLocalBranches}
124+
onDeleteUnusedLocalBranches={this.onDeleteUnusedLocalBranches}
125125
onPullSingleBranch={this.onPullSingleBranch}
126126
onRenameBranch={this.onRenameBranch}
127127
onSetAsDefaultBranch={this.onSetAsDefaultBranch}
@@ -448,7 +448,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
448448
})
449449
}
450450

451-
private onDeleteAllLocalBranches = () => {
451+
private onDeleteUnusedLocalBranches = () => {
452452
const { dispatcher, repository, repositoryState } = this.props
453453
const { allBranches } = repositoryState.branchesState
454454
const worktrees = repositoryState.worktrees
@@ -464,7 +464,7 @@ export class BranchDropdown extends React.Component<IBranchDropdownProps> {
464464
}
465465

466466
dispatcher.showPopup({
467-
type: PopupType.DeleteAllLocalBranches,
467+
type: PopupType.DeleteUnusedLocalBranches,
468468
repository,
469469
branches,
470470
})

app/styles/_ui.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
@import 'ui/banners';
5555
@import 'ui/add-repository';
5656
@import 'ui/discard-changes';
57-
@import 'ui/delete-all-local-branches';
57+
@import 'ui/delete-unused-local-branches';
5858
@import 'ui/filter-list';
5959
@import 'ui/missing-repository-view';
6060
@import 'ui/horizontal-rule';

app/styles/ui/_delete-all-local-branches.scss renamed to app/styles/ui/_delete-unused-local-branches.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#delete-all-local-branches {
2-
.delete-all-local-branches-list {
1+
#delete-unused-local-branches {
2+
.delete-unused-local-branches-list {
33
max-height: 175px;
44
overflow-y: auto;
55
list-style: none;

0 commit comments

Comments
 (0)