Support custom branches (#236)

This commit is contained in:
Danny Moesch 2019-01-06 20:10:47 +01:00 committed by Mingshen Sun
parent 744b46adc2
commit 6b4dbd50a9
6 changed files with 81 additions and 15 deletions

View file

@ -10,7 +10,8 @@ import Foundation
public enum AppError: Error {
case RepositoryNotSetError
case RepositoryRemoteMasterNotFoundError
case RepositoryRemoteBranchNotFoundError(_: String)
case RepositoryBranchNotFound(_: String)
case KeyImportError
case PasswordDuplicatedError
case GitResetError
@ -25,8 +26,10 @@ extension AppError: LocalizedError {
switch self {
case .RepositoryNotSetError:
return "Git repository is not set."
case .RepositoryRemoteMasterNotFoundError:
return "Cannot find remote branch origin/master."
case let .RepositoryRemoteBranchNotFoundError(remoteBranchName):
return "Cannot find remote branch 'origin/\(remoteBranchName)'."
case let .RepositoryBranchNotFound(branchName):
return "Branch with name '\(branchName)' not found in repository."
case .KeyImportError:
return "Cannot import the key."
case .PasswordDuplicatedError:

View file

@ -22,6 +22,7 @@ public extension DefaultsKeys {
static let gitURL = DefaultsKey<URL?>("gitURL")
static let gitAuthenticationMethod = DefaultsKey<String?>("gitAuthenticationMethod")
static let gitUsername = DefaultsKey<String?>("gitUsername")
static let gitBranchName = DefaultsKey<String?>("gitBranchName")
static let gitSSHPrivateKeyURL = DefaultsKey<URL?>("gitSSHPrivateKeyURL")
static let gitSSHKeySource = DefaultsKey<String?>("gitSSHKeySource")
static let gitSSHPrivateKeyArmor = DefaultsKey<String?>("gitSSHPrivateKeyArmor")