Skip to content

Commit f4a55b2

Browse files
pcloudsgitster
authored andcommitted
merge-blobs.c: remove implicit dependency on the_index
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 32eaa46 commit f4a55b2

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

builtin/merge-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
7676
their = NULL;
7777
if (entry)
7878
their = entry->blob;
79-
return merge_blobs(path, base, our, their, size);
79+
return merge_blobs(&the_index, path, base, our, their, size);
8080
}
8181

8282
static void *origin(struct merge_list *entry, unsigned long *size)

merge-blobs.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ static void free_mmfile(mmfile_t *f)
2929
free(f->ptr);
3030
}
3131

32-
static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
32+
static void *three_way_filemerge(struct index_state *istate,
33+
const char *path,
34+
mmfile_t *base,
35+
mmfile_t *our,
36+
mmfile_t *their,
37+
unsigned long *size)
3338
{
3439
int merge_status;
3540
mmbuffer_t res;
@@ -42,15 +47,17 @@ static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our
4247
*/
4348
merge_status = ll_merge(&res, path, base, NULL,
4449
our, ".our", their, ".their",
45-
&the_index, NULL);
50+
istate, NULL);
4651
if (merge_status < 0)
4752
return NULL;
4853

4954
*size = res.size;
5055
return res.ptr;
5156
}
5257

53-
void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
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)
5461
{
5562
void *res = NULL;
5663
mmfile_t f1, f2, common;
@@ -83,7 +90,7 @@ void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct
8390
common.ptr = xstrdup("");
8491
common.size = 0;
8592
}
86-
res = three_way_filemerge(path, &common, &f1, &f2, size);
93+
res = three_way_filemerge(istate, path, &common, &f1, &f2, size);
8794
free_mmfile(&common);
8895
out_free_f2_f1:
8996
free_mmfile(&f2);

merge-blobs.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#ifndef MERGE_BLOBS_H
22
#define MERGE_BLOBS_H
33

4-
#include "blob.h"
4+
struct blob;
5+
struct index_state;
56

6-
extern void *merge_blobs(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
7+
extern void *merge_blobs(struct index_state *, const char *,
8+
struct blob *, struct blob *,
9+
struct blob *, unsigned long *);
710

811
#endif /* MERGE_BLOBS_H */

0 commit comments

Comments
 (0)