Skip to content

Commit 6a7bce8

Browse files
committed
Use lightweight git status call instead of full refresh in trampoline
1 parent f58191a commit 6a7bce8

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,6 +3141,13 @@ export class AppStore extends TypedBaseStore<IAppState> {
31413141
return status
31423142
}
31433143

3144+
public async _loadStatusLight(
3145+
repository: Repository
3146+
): Promise<IStatusResult | null> {
3147+
const gitStore = this.gitStoreCache.get(repository)
3148+
return await gitStore.loadStatusLight()
3149+
}
3150+
31443151
/**
31453152
* This method is to initialize a multi commit operation state on app load
31463153
* if conflicts are found but not multi commmit operation exists.

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,15 @@ export class GitStore extends BaseStore {
12121212
return status
12131213
}
12141214

1215+
public async loadStatusLight(): Promise<IStatusResult | null> {
1216+
try {
1217+
return await getStatus(this.repository)
1218+
} catch (e) {
1219+
log.error('Failed to load repository status', e)
1220+
return null
1221+
}
1222+
}
1223+
12151224
/**
12161225
* Find a commit in the local cache, or load in the commit from the underlying
12171226
* repository.

app/src/lib/trampoline/trampoline-ui-helper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ class TrampolineUIHelper {
121121
public async getLoginForRepositoryPath(path: string): Promise<string | null> {
122122
const repo = await this.dispatcher.getRepositoryForPath(path)
123123
if (repo) {
124-
// TODO: Delete this line
125-
await this.dispatcher.refreshRepository(repo)
124+
await this.dispatcher.loadStatusLight(repo)
126125
}
127126
return repo?.login ?? null
128127
}

app/src/ui/dispatcher/dispatcher.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ export class Dispatcher {
414414
return this.appStore._refreshOrRecoverRepository(repository)
415415
}
416416

417+
public async loadStatusLight(repository: Repository): Promise<void> {
418+
await this.appStore._loadStatusLight(repository)
419+
}
420+
417421
/**
418422
* Refresh the commit author of a repository. Required after changing git's
419423
* user name or email address.

0 commit comments

Comments
 (0)