Skip to content

Add docs about Repository::index ownership. #922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ impl Repository {
///
/// If a custom index has not been set, the default index for the repository
/// will be returned (the one located in .git/index).
///
/// **Caution**: If the [`Repository`] of this index is dropped, then this
/// [`Index`] will become detached, and most methods on it will fail. See
/// [`Index::open`]. Be sure the repository has a binding such as a local
/// variable to keep it alive at least as long as the index.
pub fn index(&self) -> Result<Index, Error> {
let mut raw = ptr::null_mut();
unsafe {
Expand Down