rust-lang / git2-rs

libgit2 bindings for Rust
https://docs.rs/git2
Apache License 2.0
1.72k stars 390 forks source link

Feature request: Tree::get_subtree #1097

Open russkel opened 7 hours ago

russkel commented 7 hours ago

Hello,

I think this function is missing from the bindings: https://libgit2.org/libgit2/#v0.17.0/group/tree/git_tree_get_subtree

I am writing some tooling to do semantic release analysis on mono-repos and I think this would be an efficient way to get the tree for the package directories.

I would have an attempt to implement it myself but I am far too green with Rust at this point.

weihanglo commented 5 hours ago

Is that still a thing in the latest libgit2 C library? The doc you provided is libgit2 0.17.0, which is pretty old (2012) and predates Rust 1.0.

libgit2 1.8 doesn't seem to have any subtree concept in its API. Also, from my understanding, git subtree is just some manipulation on git tree object for under a certain directory. I think you are able to get your own “subtree” by identifying a git2::Tree of a path.