Skip to content

Commit

Permalink
Merge pull request rust-lang#128 from joshtriplett/set_index
Browse files Browse the repository at this point in the history
Please support git_repository_set_index
  • Loading branch information
alexcrichton committed May 8, 2016
2 parents a13c35b + 373885f commit d393aef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libgit2-sys/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,8 @@ extern {
pub fn git_repository_workdir(repo: *mut git_repository) -> *const c_char;
pub fn git_repository_index(out: *mut *mut git_index,
repo: *mut git_repository) -> c_int;
pub fn git_repository_set_index(repo: *mut git_repository,
index: *mut git_index) -> c_int;
pub fn git_repository_config(out: *mut *mut git_config,
repo: *mut git_repository) -> c_int;
pub fn git_repository_config_snapshot(out: *mut *mut git_config,
Expand Down
8 changes: 8 additions & 0 deletions src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,14 @@ impl Repository {
}
}

/// Set the Index file for this repository.
pub fn set_index(&self, index: &mut Index) -> Result<(), Error> {
unsafe {
try_call!(raw::git_repository_set_index(self.raw(), index.raw()));
}
Ok(())
}

/// Get the configuration file for this repository.
///
/// If a configuration file has not been set, the default config set for the
Expand Down

0 comments on commit d393aef

Please sign in to comment.