Inform the user about a failed push
In case there are uncommitted changes in the remote repository the push ran through successfully but there were still unpushed changes in the app. This change notfies the user about this situation. Strangely, the push method from Objective-Git does not inform about this, although the command line Git does. Thus, the check for the number of local changes is used after the push operation, which can actually have several reasons. Important is that there is at least some hint, though.
This commit is contained in:
parent
bf8f2078f5
commit
b503e5f613
4 changed files with 15 additions and 11 deletions
|
|
@ -448,7 +448,7 @@ public class PasswordStore {
|
|||
try commitEnum.pushSHA(headReference.targetOID!.sha)
|
||||
let parent = commitEnum.nextObject() as! GTCommit
|
||||
guard let signature = gitSignatureForNow else {
|
||||
throw AppError.GitCommit
|
||||
throw AppError.GitCreateSignature
|
||||
}
|
||||
let commit = try storeRepository.createCommit(with: newTree, message: message, author: signature, committer: signature, parents: [parent], updatingReferenceNamed: headReference.name)
|
||||
return commit
|
||||
|
|
@ -467,15 +467,14 @@ public class PasswordStore {
|
|||
guard let storeRepository = storeRepository else {
|
||||
throw AppError.RepositoryNotSet
|
||||
}
|
||||
do {
|
||||
let credentialProvider = try credential.credentialProvider(requestCredentialPassword: requestCredentialPassword)
|
||||
let options = [GTRepositoryRemoteOptionsCredentialProvider: credentialProvider]
|
||||
if let branch = try getLocalBranch(withName: Defaults.gitBranchName) {
|
||||
let remote = try GTRemote(name: "origin", in: storeRepository)
|
||||
try storeRepository.push(branch, to: remote, withOptions: options, progress: transferProgressBlock)
|
||||
}
|
||||
} catch {
|
||||
throw(error)
|
||||
let credentialProvider = try credential.credentialProvider(requestCredentialPassword: requestCredentialPassword)
|
||||
let options = [GTRepositoryRemoteOptionsCredentialProvider: credentialProvider]
|
||||
if let branch = try getLocalBranch(withName: Defaults.gitBranchName) {
|
||||
let remote = try GTRemote(name: "origin", in: storeRepository)
|
||||
try storeRepository.push(branch, to: remote, withOptions: options, progress: transferProgressBlock)
|
||||
}
|
||||
if numberOfLocalCommits != 0 {
|
||||
throw AppError.GitPushNotSuccessful
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue