libgit2

git_merge_driver_apply_fn

Version:

Callback to perform the merge.

Specified as driver.apply, this is the callback that actually does the merge. If it can successfully perform a merge, it should populate path_out with a pointer to the filename to accept, mode_out with the resultant mode, and merged_out with the buffer of the merged file and then return 0. If the driver returns GIT_PASSTHROUGH, then the default merge driver should instead be run. It can also return GIT_EMERGECONFLICT if the driver is not able to produce a merge result, and the file will remain conflicted. Any other errors will fail and return to the caller.

The filter_name contains the name of the filter that was invoked, as specified by the file's attributes.

The src contains the data about the file to be merged.

Signature

typedef int git_merge_driver_apply_fn(git_merge_driver *self, const char **path_out, uint32_t *mode_out, git_buf *merged_out, const char *filter_name, const git_merge_driver_source *src);

Parameters

In
self

the merge driver

const char **
In
path_out

the resolved path

uint32_t *
In
mode_out

the resolved mode

In
merged_out

the merged output contents

const char *
In
filter_name

the filter that was invoked

In
src

the data about the unmerged file

Returns

int

0 on success, or an error code

Versions