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: