Transition to using libgit2 as much as possible
The first attempt showed a 2x slowdown in load time, but a more recent try got almost 6x faster instead.
Partially done in 474653617a4465c6f5c9c436b95f37a9847dac8a
Remaining in XTRepository.m:
- [x]
contentsOfFile:atCommit: - [x]
getCommitsWithArgs:...
XTRepository+Parsing.m:
- [x]
readRefsWithLocalBlock:... - [x]
readStagedFilesWithBlock: - [x]
readStashesWithBlock: - [x]
fileNamesForRef: - [x]
parseCommit:... - [ ]
stageFile: - [ ]
unstageFile: - [ ]
commitWithMessage:amend:...
XTRepository+Commands.m: (Many of these will need to be refactored when they are UI-accessible)
- [ ]
saveStash: - [ ]
createBranch: - [x]
push:(used only in tests) - [x]
createTag: - [x]
deleteTag: - [x]
addRemote:withUrl: - [x]
deleteRemote:error: - [x]
diffForStagedFile: - [x]
diffForUnstagedFile: - [x]
diffForCommit: - [ ]
stagePatch: - [ ]
unstagePatch: - [ ]
discardPatch: - [x]
renameBranch: - [ ]
renameRemote: - [x]
dropStash:error: - [ ]
merge:error: - [x]
popStash:error: - [x]
applyStash:error:
I tried to do saveStash: but the tests all failed
- (BOOL)saveStash:(NSString*)name includeUntracked:(BOOL)untracked
{
const GTRepositoryStashFlag flags = untracked ?
GTRepositoryStashFlagIncludeUntracked :
GTRepositoryStashFlagDefault;
NSError *error = nil;
GTCommit *result =
[self.gtRepo stashChangesWithMessage:nil flags:flags error:&error];
return result != nil;
}
I'm actually thinking about phasing out Objective Git and using libgit2 directly. It's one less dependency, and easier to manage which version of libgit2 is used.
Note that there is an implementation of Blame using libgit2, but it can be a lot slower in large repositories so the CLI version will be used until that is fixed.