mirror of
https://github.com/desktop/desktop
synced 2024-10-30 06:03:10 +00:00
Merge pull request #18083 from desktop/fix-amend-non-gh-repo
Restore message of commit to amend for non GitHub repos
This commit is contained in:
commit
cf10b38882
2 changed files with 15 additions and 2 deletions
|
@ -4860,7 +4860,7 @@ export class AppStore extends TypedBaseStore<IAppState> {
|
|||
)
|
||||
|
||||
const gitStore = this.gitStoreCache.get(repository)
|
||||
await gitStore.restoreCoAuthorsFromCommit(commit)
|
||||
await gitStore.prepareToAmendCommit(commit)
|
||||
|
||||
this.setRepositoryCommitToAmend(repository, commit)
|
||||
|
||||
|
|
|
@ -716,7 +716,20 @@ export class GitStore extends BaseStore {
|
|||
this.emitUpdate()
|
||||
}
|
||||
|
||||
public async restoreCoAuthorsFromCommit(commit: Commit) {
|
||||
public async prepareToAmendCommit(commit: Commit) {
|
||||
const coAuthorsRestored = await this.restoreCoAuthorsFromCommit(commit)
|
||||
if (coAuthorsRestored) {
|
||||
return
|
||||
}
|
||||
|
||||
this._commitMessage = {
|
||||
summary: commit.summary,
|
||||
description: commit.body,
|
||||
}
|
||||
this.emitUpdate()
|
||||
}
|
||||
|
||||
private async restoreCoAuthorsFromCommit(commit: Commit) {
|
||||
// Let's be safe about this since it's untried waters.
|
||||
// If we can restore co-authors then that's fantastic
|
||||
// but if we can't we shouldn't be throwing an error,
|
||||
|
|
Loading…
Reference in a new issue