libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

[Proposal] Add git_blame_buffer

Open 9at8 opened this issue 3 years ago • 0 comments

Motivation and Background

I was trying to make a VS extension that implements something like GitLens on VSCode. If you don't know what that is that's ok. It has a lot of features, but the main thing that I use it for is to view per line blame along with the commit message like so:

image

I am using libgit2sharp to develop my extension. Currently I'm using repo.Blame(filePath) to get grab the BlameHunkCollection and display the message on a line using the VS extensibility api. repo.Blame uses git_blame_file under the hood and git_blame_file has a couple of issues for my usecase:

  • It is really slow
  • I can get an accurate blame result only after saving the file to disk. In other words, I cannot get the blame results for a file that is still being worked on/is open in memory

Purpose of this PR

I am creating this PR to start a discussion for adding something similar to git_blame_buffer to libgit2sharp. There might be a better way to implement this functionality, and I would to get some feedback and bounce ideas to add this feature to the library in the best way possible.

9at8 avatar Jul 30 '22 00:07 9at8