libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.17k stars 886 forks source link

[Proposal] Add git_blame_buffer #1979

Open 9at8 opened 2 years ago

9at8 commented 2 years ago

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:

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.