Xit icon indicating copy to clipboard operation
Xit copied to clipboard

Transition to using libgit2 as much as possible

Open Uncommon opened this issue 12 years ago • 4 comments

The first attempt showed a 2x slowdown in load time, but a more recent try got almost 6x faster instead.

Uncommon avatar Feb 14 '13 03:02 Uncommon

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:

Uncommon avatar Jul 20 '13 18:07 Uncommon

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;
}

Uncommon avatar Jun 16 '16 16:06 Uncommon

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.

Uncommon avatar Nov 22 '16 15:11 Uncommon

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.

Uncommon avatar Apr 30 '19 15:04 Uncommon