Fix #326: Do not assume 'master' as the default checked out branch

This commit is contained in:
Danny Moesch 2019-11-07 23:25:46 +01:00 committed by Mingshen Sun
parent de88b27d1a
commit 4c47729a6e
4 changed files with 15 additions and 8 deletions

View file

@ -78,8 +78,8 @@ class GitServerSettingTableViewController: UITableViewController {
private func cloneAndSegueIfSuccess() {
// try to clone
let gitRepostiroyURL = gitURLTextField.text!.trimmed
let username = usernameTextField.text!
let branchName = branchNameTextField.text!
let username = usernameTextField.text!.trimmed
let branchName = branchNameTextField.text!.trimmed
let auth = authenticationMethod
SVProgressHUD.setDefaultMaskType(.black)
@ -121,7 +121,7 @@ class GitServerSettingTableViewController: UITableViewController {
let error = error as NSError
var message = error.localizedDescription
if let underlyingError = error.userInfo[NSUnderlyingErrorKey] as? NSError {
message = "\(message)\n\("UnderlyingError".localize()): \(underlyingError.localizedDescription)"
message = "\(message)\n\("UnderlyingError".localize(underlyingError.localizedDescription))"
}
Utils.alert(title: "Error".localize(), message: message, controller: self, completion: nil)
}
@ -179,6 +179,11 @@ class GitServerSettingTableViewController: UITableViewController {
return
}
guard let branchName = branchNameTextField.text, !branchName.trimmed.isEmpty else {
Utils.alert(title: "CannotSave".localize(), message: "SpecifyBranchName.".localize(), controller: self, completion: nil)
return
}
switch gitURL.scheme {
case let val where val == "https":
break