rust-lang / git2-rs

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

question about ceiling_dirs in open_ext #892

Closed keepsimple1 closed 1 year ago

keepsimple1 commented 1 year ago

https://github.com/rust-lang/git2-rs/blob/ca6b3346d2e50e79d7c160cbee82ee65e2bcd701/src/repo.rs#L3456

subdir does not point to a git repo. Its parent directory is the repo. Why is it okay to use subdir as the ceiling_dirs?

ehuss commented 1 year ago

This was changed as part of https://github.com/libgit2/libgit2/commit/ed577134a5dcf30c95b740859aceebd9c1137157 to match the behavior of the git CLI. As part of git's documentation "It will not exclude the current working directory". There was some back-and-forth discussion about that behavior in the original patch that introduced this feature, and I think it boiled down to the author wanted it that way.

I agree it was a little surprising to me.

keepsimple1 commented 1 year ago

Thanks for the info & links! I will close this issue.