Search code examples
gitrustlibgit2

Git2-rs status of files in commit log


Can I find out in Git2-rs / libgit2 about the status of a file like added/removed/modified from the commit log? I've looked at the documentation but only find Diff Trees.


Solution

  • To my knowledge, there's no direct access to the status of a specific path but you can use the statuses function of a repository to iterate over all the statuses it knows and look at the path of each StatusEntry.

    To make it more efficient if you have several paths for which you'd like to know the status, you can do the iteration, build a map from paths to statuses, then query this map for every path you're interested in.