I got another libgit2 issue and will be very grateful for your help.
I’m trying to retrieve file history, i.e. list of commits where this file was changed. And it seems to be quite unconventional… As far as I can see, there are no function for that.
The only approach I can come up with is to use revision walking API to iterate through revisions, check the tree object attached to commit and search for given file there, if found, add commit to my list, otherwise proceed to next commit.
But it looks none-optimal for me…
May be is there any other approach, for example, look directly into .git folder and get needed information there?
Many thanks in advance!
Your approach is the correct one. Beware that you’ll have to fight against:
Even though understanding the .git folder layout is always a well-spent time, I’m afraid this won’t help you with this specific file history issue.
Note: this question is very close from this libgit2sharp issue: How to get the last commit that affected a given file?
Update
Pull request #963 adds this very feature.
It’s available since
LibGit2Sharp.0.22.0-pre20150415174523pre-release NuGet package.