Skip to content

Commit dd3ec60

Browse files
committed
Update repository account before attempting to push
1 parent a1ecb00 commit dd3ec60

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5725,7 +5725,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
57255725
public async _updateRepositoryAccount(
57265726
repository: Repository,
57275727
account: Account | null
5728-
): Promise<void> {
5728+
): Promise<Repository> {
57295729
if (repository.gitHubRepository && account === null) {
57305730
await this.repositoriesStore.clearGitHubRepositoryLogin(
57315731
repository.gitHubRepository
@@ -5739,6 +5739,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
57395739
repo
57405740
)
57415741
await this._refreshRepository(refreshedRepo)
5742+
return refreshedRepo
57425743
}
57435744

57445745
public async _updateRepositoryEditorOverride(
@@ -6287,7 +6288,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
62876288

62886289
/** This shouldn't be called directly. See `Dispatcher`. */
62896290
public async _publishRepository(
6290-
repository: Repository,
6291+
oldRepo: Repository,
62916292
name: string,
62926293
description: string,
62936294
private_: boolean,
@@ -6302,8 +6303,11 @@ export class AppStore extends TypedBaseStore<IAppState> {
63026303
private_
63036304
)
63046305

6305-
const gitStore = this.gitStoreCache.get(repository)
6306+
const gitStore = this.gitStoreCache.get(oldRepo)
63066307
await gitStore.addRemote('origin', apiRepository.clone_url)
6308+
await gitStore.refreshDefaultBranch()
6309+
6310+
const repository = await this._updateRepositoryAccount(oldRepo, account)
63076311

63086312
// skip pushing if the current branch is a detached HEAD or the repository
63096313
// is unborn
@@ -6320,9 +6324,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
63206324
await this.performPush(repository)
63216325
}
63226326

6323-
await gitStore.refreshDefaultBranch()
6324-
6325-
return this.repositoryWithRefreshedGitHubRepository(repository)
6327+
return repository
63266328
}
63276329

63286330
/** This shouldn't be called directly. See `Dispatcher`. */

app/src/ui/dispatcher/dispatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ export class Dispatcher {
970970
public updateRepositoryAccount(
971971
repository: Repository,
972972
account: Account | null
973-
): Promise<void> {
973+
): Promise<Repository> {
974974
account = account?.isAnonymous ? null : account
975975
return this.appStore._updateRepositoryAccount(repository, account)
976976
}

0 commit comments

Comments
 (0)