Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some “Stage All” special cases #1037

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions GitUpKit/Extensions/GCRepository+Index.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,16 @@ - (BOOL)addFilesToIndex:(NSArray<NSString*>*)paths error:(NSError**)error {
shouldWriteRepository = YES;
}

if (failed && shouldWriteRepository) {
if (shouldWriteRepository) {
if (shouldWriteRepository) {
if (failed) {
[self writeRepositoryIndex:index error:NULL];
return NO;
}
return NO;

return [self writeRepositoryIndex:index error:error];
}

return [self writeRepositoryIndex:index error:error];
return !failed;
}

- (BOOL)resetFileInIndexToHEAD:(NSString*)path error:(NSError**)error {
Expand Down
12 changes: 10 additions & 2 deletions GitUpKit/Extensions/GCRepository+Utilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,19 @@ - (BOOL)syncIndexWithWorkingDirectory:(NSError**)error {
if (delta.submodule) {
GCSubmodule* submodule = [self lookupSubmoduleWithName:delta.canonicalPath error:error];
if (!submodule || ![self addSubmoduleToRepositoryIndex:submodule error:error]) {
return NO;
if (![[*error localizedDescription] hasSuffix:@"' has not been added yet"]) {
return NO;
}
}
} else {
if (![self addFileInWorkingDirectory:delta.canonicalPath toIndex:index error:error]) {
return NO;
BOOL wasJustTryingToStageADeletedConflictingFile =
delta.change == kGCFileDiffChange_Conflicted
&& [[*error localizedDescription] isEqualToString:@"No such file or directory"];

if (!wasJustTryingToStageADeletedConflictingFile) {
return NO;
}
}
}
break;
Expand Down