]>
git.ipfire.org Git - thirdparty/git.git/blob - merge-blobs.c
2 #include "run-command.h"
3 #include "xdiff-interface.h"
6 #include "merge-blobs.h"
7 #include "object-store.h"
9 static int fill_mmfile_blob(mmfile_t
*f
, struct blob
*obj
)
13 enum object_type type
;
15 buf
= read_object_file(&obj
->object
.oid
, &type
, &size
);
18 if (type
!= OBJ_BLOB
) {
27 static void free_mmfile(mmfile_t
*f
)
32 static void *three_way_filemerge(struct index_state
*istate
,
43 * This function is only used by cmd_merge_tree, which
44 * does not respect the merge.conflictstyle option.
45 * There is no need to worry about a label for the
48 merge_status
= ll_merge(&res
, path
, base
, NULL
,
49 our
, ".our", their
, ".their",
58 void *merge_blobs(struct index_state
*istate
, const char *path
,
59 struct blob
*base
, struct blob
*our
,
60 struct blob
*their
, unsigned long *size
)
63 mmfile_t f1
, f2
, common
;
66 * Removed in either branch?
68 * NOTE! This depends on the caller having done the
69 * proper warning about removing a file that got
70 * modified in the other branch!
73 enum object_type type
;
78 return read_object_file(&our
->object
.oid
, &type
, size
);
81 if (fill_mmfile_blob(&f1
, our
) < 0)
83 if (fill_mmfile_blob(&f2
, their
) < 0)
87 if (fill_mmfile_blob(&common
, base
) < 0)
90 common
.ptr
= xstrdup("");
93 res
= three_way_filemerge(istate
, path
, &common
, &f1
, &f2
, size
);