mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 13:04:42 +00:00
Get rid of redundant git_diff_options_init fn
Since git_diff_init_options was introduced, remove this old fn.
This commit is contained in:
parent
b23b112dfe
commit
7a2e56a3f6
@ -811,23 +811,6 @@ GIT_EXTERN(int) git_diff_find_similar(
|
|||||||
git_diff *diff,
|
git_diff *diff,
|
||||||
const git_diff_find_options *options);
|
const git_diff_find_options *options);
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize diff options structure
|
|
||||||
*
|
|
||||||
* In most cases, you can probably just use `GIT_DIFF_OPTIONS_INIT` to
|
|
||||||
* initialize the diff options structure, but in some cases that is not
|
|
||||||
* going to work. You can call this function instead. Note that you
|
|
||||||
* must pass both a pointer to the structure to be initialized and the
|
|
||||||
* `GIT_DIFF_OPTIONS_VERSION` value from the header you compiled with.
|
|
||||||
*
|
|
||||||
* @param options Pointer to git_diff_options memory to be initialized
|
|
||||||
* @param version Should be `GIT_DIFF_OPTIONS_VERSION`
|
|
||||||
* @return 0 on success, negative on failure (such as unsupported version)
|
|
||||||
*/
|
|
||||||
GIT_EXTERN(int) git_diff_options_init(
|
|
||||||
git_diff_options *options,
|
|
||||||
unsigned int version);
|
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
|
||||||
|
14
src/diff.c
14
src/diff.c
@ -1282,20 +1282,6 @@ int git_diff_tree_to_workdir_with_index(
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_diff_options_init(git_diff_options *options, unsigned int version)
|
|
||||||
{
|
|
||||||
git_diff_options template = GIT_DIFF_OPTIONS_INIT;
|
|
||||||
|
|
||||||
if (version != template.version) {
|
|
||||||
giterr_set(GITERR_INVALID,
|
|
||||||
"Invalid version %d for git_diff_options", (int)version);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(options, &template, sizeof(*options));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t git_diff_num_deltas(const git_diff *diff)
|
size_t git_diff_num_deltas(const git_diff *diff)
|
||||||
{
|
{
|
||||||
assert(diff);
|
assert(diff);
|
||||||
|
@ -26,7 +26,7 @@ void test_diff_blob__initialize(void)
|
|||||||
|
|
||||||
g_repo = cl_git_sandbox_init("attr");
|
g_repo = cl_git_sandbox_init("attr");
|
||||||
|
|
||||||
cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
|
cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
|
||||||
opts.context_lines = 1;
|
opts.context_lines = 1;
|
||||||
|
|
||||||
memset(&expected, 0, sizeof(expected));
|
memset(&expected, 0, sizeof(expected));
|
||||||
|
@ -9,7 +9,7 @@ static diff_expects expect;
|
|||||||
|
|
||||||
void test_diff_tree__initialize(void)
|
void test_diff_tree__initialize(void)
|
||||||
{
|
{
|
||||||
cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
|
cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
|
||||||
|
|
||||||
memset(&expect, 0, sizeof(expect));
|
memset(&expect, 0, sizeof(expect));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user