mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-14 14:28:23 +00:00
merge driver: get a pointer to favor
This commit is contained in:
parent
4662583692
commit
7a3ab14fee
@ -918,7 +918,7 @@ static int merge_conflict_resolve_contents(
|
|||||||
* favor flag) then let that override the gitattributes.
|
* favor flag) then let that override the gitattributes.
|
||||||
*/
|
*/
|
||||||
driver = &git_merge_driver__normal;
|
driver = &git_merge_driver__normal;
|
||||||
data = (void *)file_opts->favor;
|
data = (void **)&file_opts->favor;
|
||||||
} else {
|
} else {
|
||||||
/* find the merge driver for this file */
|
/* find the merge driver for this file */
|
||||||
if ((error = git_merge_driver_for_source(&driver, &data, &source)) < 0)
|
if ((error = git_merge_driver_for_source(&driver, &data, &source)) < 0)
|
||||||
|
@ -28,6 +28,9 @@ typedef struct {
|
|||||||
|
|
||||||
static struct merge_driver_registry *merge_driver_registry = NULL;
|
static struct merge_driver_registry *merge_driver_registry = NULL;
|
||||||
|
|
||||||
|
static git_merge_file_favor_t merge_favor_normal = GIT_MERGE_FILE_FAVOR_NORMAL;
|
||||||
|
static git_merge_file_favor_t merge_favor_union = GIT_MERGE_FILE_FAVOR_UNION;
|
||||||
|
|
||||||
static int merge_driver_apply(
|
static int merge_driver_apply(
|
||||||
git_merge_driver *self,
|
git_merge_driver *self,
|
||||||
void **payload,
|
void **payload,
|
||||||
@ -37,6 +40,7 @@ static int merge_driver_apply(
|
|||||||
const git_merge_driver_source *src)
|
const git_merge_driver_source *src)
|
||||||
{
|
{
|
||||||
git_merge_file_options file_opts = GIT_MERGE_FILE_OPTIONS_INIT;
|
git_merge_file_options file_opts = GIT_MERGE_FILE_OPTIONS_INIT;
|
||||||
|
git_merge_file_favor_t *favor = (git_merge_file_favor_t *) *payload;
|
||||||
git_merge_file_result result = {0};
|
git_merge_file_result result = {0};
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -45,7 +49,8 @@ static int merge_driver_apply(
|
|||||||
if (src->file_opts)
|
if (src->file_opts)
|
||||||
memcpy(&file_opts, src->file_opts, sizeof(git_merge_file_options));
|
memcpy(&file_opts, src->file_opts, sizeof(git_merge_file_options));
|
||||||
|
|
||||||
file_opts.favor = (git_merge_file_favor_t) *payload;
|
if (favor)
|
||||||
|
file_opts.favor = *favor;
|
||||||
|
|
||||||
if ((error = git_merge_file_from_index(&result, src->repo,
|
if ((error = git_merge_file_from_index(&result, src->repo,
|
||||||
src->ancestor, src->ours, src->theirs, &file_opts)) < 0)
|
src->ancestor, src->ours, src->theirs, &file_opts)) < 0)
|
||||||
@ -87,7 +92,7 @@ static int merge_driver_text_check(
|
|||||||
GIT_UNUSED(name);
|
GIT_UNUSED(name);
|
||||||
GIT_UNUSED(src);
|
GIT_UNUSED(src);
|
||||||
|
|
||||||
*payload = (void *)GIT_MERGE_FILE_FAVOR_NORMAL;
|
*payload = &merge_favor_normal;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +106,7 @@ static int merge_driver_union_check(
|
|||||||
GIT_UNUSED(name);
|
GIT_UNUSED(name);
|
||||||
GIT_UNUSED(src);
|
GIT_UNUSED(src);
|
||||||
|
|
||||||
*payload = (void *)GIT_MERGE_FILE_FAVOR_UNION;
|
*payload = &merge_favor_union;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user