mirror of
https://git.proxmox.com/git/libgit2
synced 2026-08-26 20:08:02 +00:00
Add explicit git_index ptr to diff and checkout
A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
This commit is contained in:
@@ -199,13 +199,15 @@ GIT_EXTERN(int) git_checkout_head(
|
||||
/**
|
||||
* Updates files in the working tree to match the content of the index.
|
||||
*
|
||||
* @param repo repository to check out (must be non-bare)
|
||||
* @param repo repository into which to check out (must be non-bare)
|
||||
* @param index index to be checked out (or NULL to use repository index)
|
||||
* @param opts specifies checkout options (may be NULL)
|
||||
* @return 0 on success, GIT_ERROR otherwise (use giterr_last for information
|
||||
* about the error)
|
||||
*/
|
||||
GIT_EXTERN(int) git_checkout_index(
|
||||
git_repository *repo,
|
||||
git_index *index,
|
||||
git_checkout_opts *opts);
|
||||
|
||||
/**
|
||||
|
||||
@@ -339,12 +339,14 @@ GIT_EXTERN(int) git_diff_tree_to_tree(
|
||||
* @param diff Output pointer to a git_diff_list pointer to be allocated.
|
||||
* @param repo The repository containing the tree and index.
|
||||
* @param old_tree A git_tree object to diff from.
|
||||
* @param index The index to diff with; repo index used if NULL.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_index_to_tree(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_tree *old_tree,
|
||||
git_index *index,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
@@ -357,11 +359,13 @@ GIT_EXTERN(int) git_diff_index_to_tree(
|
||||
*
|
||||
* @param diff Output pointer to a git_diff_list pointer to be allocated.
|
||||
* @param repo The repository.
|
||||
* @param index The index to diff from; repo index used if NULL.
|
||||
* @param opts Structure with options to influence diff or NULL for defaults.
|
||||
*/
|
||||
GIT_EXTERN(int) git_diff_workdir_to_index(
|
||||
git_diff_list **diff,
|
||||
git_repository *repo,
|
||||
git_index *index,
|
||||
const git_diff_options *opts); /**< can be NULL for defaults */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user