Skip to content

Commit fef02c3

Browse files
committed
Reduce fork diff with respect to upstream
The goal of these changes is to make future merges easier, without modifying current behavior.
1 parent 816cbe6 commit fef02c3

4 files changed

Lines changed: 89 additions & 76 deletions

File tree

app/src/lib/stores/app-store.ts

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,13 +3327,15 @@ export class AppStore extends TypedBaseStore<IAppState> {
33273327
const isStashedChangesVisible =
33283328
changesState.selection.kind === ChangesSelectionKind.Stash
33293329

3330+
const askForConfirmationWhenStashingAllChanges = false
3331+
33303332
updatePreferredAppMenuItemLabels({
33313333
...labels,
33323334
contributionTargetDefaultBranch,
33333335
isForcePushForCurrentRepository,
33343336
isStashedChangesVisible,
33353337
hasCurrentPullRequest: currentPullRequest !== null,
3336-
askForConfirmationWhenStashingAllChanges: false,
3338+
askForConfirmationWhenStashingAllChanges,
33373339
})
33383340
}
33393341

@@ -4582,10 +4584,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
45824584
/**
45834585
* Update the repository sidebar indicator for the repository
45844586
*/
4585-
private updateSidebarIndicator(
4587+
private async updateSidebarIndicator(
45864588
repository: Repository,
45874589
status: IStatusResult | null
4588-
): void {
4590+
): Promise<void> {
45894591
const lookup = this.localRepositoryStateLookup
45904592

45914593
if (repository.missing) {
@@ -5378,7 +5380,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
53785380
}
53795381

53805382
const { account, owner, name } = match
5381-
53825383
const { endpoint } = account
53835384
const api = API.fromAccount(account)
53845385
const apiRepo = await api.fetchRepository(owner, name)
@@ -5495,69 +5496,6 @@ export class AppStore extends TypedBaseStore<IAppState> {
54955496
return this.repositoriesStore.updateRepositoryAlias(repository, newAlias)
54965497
}
54975498

5498-
/** This shouldn't be called directly. See `Dispatcher`. */
5499-
public async _changeRepositoryGroupName(
5500-
repository: Repository,
5501-
newGroupName: string | null
5502-
): Promise<void> {
5503-
const mainPath = normalizePath(
5504-
repository.isLinkedWorktree
5505-
? repository.mainWorktreePath
5506-
: repository.path
5507-
)
5508-
const reposToUpdate = this.repositories.filter(
5509-
r =>
5510-
normalizePath(r.path) === mainPath ||
5511-
(r.isLinkedWorktree && normalizePath(r.mainWorktreePath) === mainPath)
5512-
)
5513-
return this.repositoriesStore.updateRepositoryGroupName(
5514-
reposToUpdate,
5515-
newGroupName
5516-
)
5517-
}
5518-
5519-
/** This shouldn't be called directly. See `Dispatcher`. */
5520-
public async _updateRepositoryDefaultBranch(
5521-
repository: Repository,
5522-
defaultBranch: string | null
5523-
): Promise<void> {
5524-
const repo = await this.repositoriesStore.updateRepositoryDefaultBranch(
5525-
repository,
5526-
defaultBranch
5527-
)
5528-
await this._refreshRepository(repo)
5529-
}
5530-
5531-
/** This shouldn't be called directly. See `Dispatcher`. */
5532-
public async _updateRepositoryAccount(
5533-
repository: Repository,
5534-
account: Account | null
5535-
): Promise<void> {
5536-
if (repository.gitHubRepository && account === null) {
5537-
await this.repositoriesStore.clearGitHubRepositoryLogin(
5538-
repository.gitHubRepository
5539-
)
5540-
}
5541-
const repo = await this.repositoriesStore.updateRepositoryAccount(
5542-
repository,
5543-
account
5544-
)
5545-
const refreshedRepo = await this.repositoryWithRefreshedGitHubRepository(
5546-
repo
5547-
)
5548-
await this._refreshRepository(refreshedRepo)
5549-
}
5550-
5551-
public async _updateRepositoryEditorOverride(
5552-
repository: Repository,
5553-
customEditorOverride: EditorOverride | null
5554-
): Promise<void> {
5555-
await this.repositoriesStore.updateRepositoryEditorOverride(
5556-
repository,
5557-
customEditorOverride
5558-
)
5559-
}
5560-
55615499
/** This shouldn't be called directly. See `Dispatcher`. */
55625500
public async _renameBranch(
55635501
repository: Repository,
@@ -5744,6 +5682,69 @@ export class AppStore extends TypedBaseStore<IAppState> {
57445682
return branchToCheckout
57455683
}
57465684

5685+
/** This shouldn't be called directly. See `Dispatcher`. */
5686+
public async _changeRepositoryGroupName(
5687+
repository: Repository,
5688+
newGroupName: string | null
5689+
): Promise<void> {
5690+
const mainPath = normalizePath(
5691+
repository.isLinkedWorktree
5692+
? repository.mainWorktreePath
5693+
: repository.path
5694+
)
5695+
const reposToUpdate = this.repositories.filter(
5696+
r =>
5697+
normalizePath(r.path) === mainPath ||
5698+
(r.isLinkedWorktree && normalizePath(r.mainWorktreePath) === mainPath)
5699+
)
5700+
return this.repositoriesStore.updateRepositoryGroupName(
5701+
reposToUpdate,
5702+
newGroupName
5703+
)
5704+
}
5705+
5706+
/** This shouldn't be called directly. See `Dispatcher`. */
5707+
public async _updateRepositoryDefaultBranch(
5708+
repository: Repository,
5709+
defaultBranch: string | null
5710+
): Promise<void> {
5711+
const repo = await this.repositoriesStore.updateRepositoryDefaultBranch(
5712+
repository,
5713+
defaultBranch
5714+
)
5715+
await this._refreshRepository(repo)
5716+
}
5717+
5718+
/** This shouldn't be called directly. See `Dispatcher`. */
5719+
public async _updateRepositoryAccount(
5720+
repository: Repository,
5721+
account: Account | null
5722+
): Promise<void> {
5723+
if (repository.gitHubRepository && account === null) {
5724+
await this.repositoriesStore.clearGitHubRepositoryLogin(
5725+
repository.gitHubRepository
5726+
)
5727+
}
5728+
const repo = await this.repositoriesStore.updateRepositoryAccount(
5729+
repository,
5730+
account
5731+
)
5732+
const refreshedRepo = await this.repositoryWithRefreshedGitHubRepository(
5733+
repo
5734+
)
5735+
await this._refreshRepository(refreshedRepo)
5736+
}
5737+
5738+
public async _updateRepositoryEditorOverride(
5739+
repository: Repository,
5740+
customEditorOverride: EditorOverride | null
5741+
): Promise<void> {
5742+
await this.repositoriesStore.updateRepositoryEditorOverride(
5743+
repository,
5744+
customEditorOverride
5745+
)
5746+
}
5747+
57475748
private updatePushPullFetchProgress(
57485749
repository: Repository,
57495750
pushPullFetchProgress: Progress | null

app/src/main-process/app-window.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from 'electron'
99
import { shell } from '../lib/app-shell'
1010
import { Emitter, Disposable } from 'event-kit'
11-
import { join } from 'path'
1211
import { encodePathAsUrl } from '../lib/path'
1312
import {
1413
getWindowState,
@@ -20,6 +19,7 @@ import { URLActionType } from '../lib/parse-app-url'
2019
import { ILaunchStats } from '../lib/stats'
2120
import { menuFromElectronMenu } from '../models/app-menu'
2221
import { now } from './now'
22+
import * as path from 'path'
2323
import windowStateKeeper from 'electron-window-state'
2424
import * as ipcMain from './ipc-main'
2525
import * as ipcWebContents from './ipc-webcontents'
@@ -83,7 +83,12 @@ export class AppWindow {
8383
if (config.titleBarStyle === 'custom') {
8484
windowOptions.frame = false
8585
}
86-
windowOptions.icon = join(__dirname, 'static', 'logos', '512x512.png')
86+
windowOptions.icon = path.join(
87+
__dirname,
88+
'static',
89+
'logos',
90+
'512x512.png'
91+
)
8792
windowOptions.autoHideMenuBar =
8893
config.titleBarStyle === 'native-without-menu-bar'
8994

app/src/main-process/menu/build-default-menu.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import { mkdir } from 'fs/promises'
1111
import { buildTestMenu } from './build-test-menu'
1212
import { assertNever } from '../../lib/fatal-error'
1313

14+
const createPullRequestLabel = __DARWIN__
15+
? 'Create Pull Request'
16+
: 'Create &pull request'
1417
const defaultBranchNameValue = __DARWIN__ ? 'Default Branch' : 'default branch'
1518
const confirmRepositoryRemovalLabel = __DARWIN__ ? 'Remove…' : '&Remove…'
1619
const repositoryRemovalLabel = __DARWIN__ ? 'Remove' : '&Remove'
@@ -53,9 +56,6 @@ export function buildDefaultMenu({
5356
? confirmRepositoryRemovalLabel
5457
: repositoryRemovalLabel
5558

56-
const createPullRequestLabel = __DARWIN__
57-
? 'Create Pull Request'
58-
: 'Create &pull request'
5959
const showPullRequestLabel =
6060
(__DARWIN__ ? 'View Pull Request ' : 'View &pull request ') +
6161
onGithubLabel(gitHubRepositoryType)

app/src/ui/app.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,9 +1653,16 @@ export class App extends React.Component<IAppProps, IAppState> {
16531653
/>
16541654
)
16551655
case PopupType.ConfirmDiscardChanges:
1656-
const showSetting = popup.showDiscardChangesSetting ?? true
1657-
const discardingAllChanges = popup.discardingAllChanges ?? false
1656+
const showSetting =
1657+
popup.showDiscardChangesSetting === undefined
1658+
? true
1659+
: popup.showDiscardChangesSetting
1660+
const discardingAllChanges =
1661+
popup.discardingAllChanges === undefined
1662+
? false
1663+
: popup.discardingAllChanges
16581664
const permanentlyDelete = popup.permanentlyDelete ?? false
1665+
16591666
return (
16601667
<DiscardChanges
16611668
key="discard-changes"
@@ -2266,12 +2273,12 @@ export class App extends React.Component<IAppProps, IAppState> {
22662273
}
22672274
case PopupType.LocalChangesOverwritten:
22682275
// Now that we support multiple stashes, lie to the dialog so that it always shows the "stash changes" option.
2269-
const existingStash = false
2276+
const existingStash = null
22702277
return (
22712278
<LocalChangesOverwrittenDialog
22722279
repository={popup.repository}
22732280
dispatcher={this.props.dispatcher}
2274-
hasExistingStash={existingStash}
2281+
hasExistingStash={existingStash !== null}
22752282
retryAction={popup.retryAction}
22762283
onDismissed={onPopupDismissedFn}
22772284
files={popup.files}

0 commit comments

Comments
 (0)