Skip to content

Commit 43c1aed

Browse files
committed
bugfix
1 parent ca5dd56 commit 43c1aed

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

Coding_iOS/Models/Login.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ - (NSDictionary *)toParams{
4040
if (self.j_captcha.length > 0) {
4141
params[@"j_captcha"] = self.j_captcha;
4242
}
43-
[Login p_setPassword:self.password forAccount:self.email];//保存一下密码
43+
[Login p_setPassword:self.password forAccount:self.email.lowercaseString];//保存一下密码
4444
return params;
4545
}
4646

Coding_iOS/Models/Project.m

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,24 +220,33 @@ - (void)gitPullBlock:(void(^)(BOOL result, NSString *tipStr))handleBlock progres
220220
}else{
221221
GTConfiguration *configuration = [repo configurationWithError:nil];
222222
GTRemote *remote = configuration.remotes.firstObject;
223-
BOOL success = NO;
224-
GTBranch *masterBranch = [repo lookUpBranchWithName:@"master" type:GTBranchTypeLocal success:&success error:nil];
225-
if (!remote || !masterBranch) {
223+
if (!remote) {
226224
handleBlock(NO, @"仓库信息不完整");
227225
}else{
228226
__weak typeof(self) weakSelf = self;
229227
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
230-
NSMutableDictionary *options = @{GTRepositoryRemoteOptionsDownloadTags: @(GTRemoteDownloadTagsAuto)}.mutableCopy;
231-
if (weakSelf.is_public && !weakSelf.is_public.boolValue) {//私有项目
232-
options[GTRepositoryRemoteOptionsCredentialProvider] = [weakSelf.class p_credentialProvider];
233-
}
234228
NSError *error = nil;
235-
BOOL result = [repo pullBranch:masterBranch fromRemote:remote withOptions:options error:&error progress:progressBlock];
236-
dispatch_async(dispatch_get_main_queue(), ^{
237-
if (handleBlock) {
238-
handleBlock(result, error.localizedDescription);
229+
NSArray<GTBranch *> *branchList = [repo localBranchesWithError:&error];
230+
if (branchList.count > 0) {
231+
GTBranch *curBranch = branchList.firstObject;
232+
NSMutableDictionary *options = @{GTRepositoryRemoteOptionsDownloadTags: @(GTRemoteDownloadTagsAuto)}.mutableCopy;
233+
if (weakSelf.is_public && !weakSelf.is_public.boolValue) {//私有项目
234+
options[GTRepositoryRemoteOptionsCredentialProvider] = [weakSelf.class p_credentialProvider];
239235
}
240-
});
236+
NSError *error = nil;
237+
BOOL result = [repo pullBranch:curBranch fromRemote:remote withOptions:options error:&error progress:progressBlock];
238+
dispatch_async(dispatch_get_main_queue(), ^{
239+
if (handleBlock) {
240+
handleBlock(result, error.localizedDescription);
241+
}
242+
});
243+
}else{
244+
dispatch_async(dispatch_get_main_queue(), ^{
245+
if (handleBlock) {
246+
handleBlock(NO, @"本地分支为空,请删除后,重新 clone 代码");
247+
}
248+
});
249+
}
241250
});
242251
}
243252
}

0 commit comments

Comments
 (0)