]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge-blobs.c: remove implicit dependency on the_index
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 21 Sep 2018 15:57:28 +0000 (17:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Sep 2018 16:48:10 +0000 (09:48 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge-tree.c
merge-blobs.c
merge-blobs.h

index f8023bae1e2eceaa8ea086f5d990d8bc4c0e6121..f32941fdabf7a1e0e89442264b225becab60c882 100644 (file)
@@ -76,7 +76,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
        their = NULL;
        if (entry)
                their = entry->blob;
-       return merge_blobs(path, base, our, their, size);
+       return merge_blobs(&the_index, path, base, our, their, size);
 }
 
 static void *origin(struct merge_list *entry, unsigned long *size)
index 668fb2e05dd39ecb45f7f78a86949b2d98c80ebf..ee0a0e90c94682f4d990b298d27d734d01d90581 100644 (file)
@@ -29,7 +29,12 @@ static void free_mmfile(mmfile_t *f)
        free(f->ptr);
 }
 
-static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our, mmfile_t *their, unsigned long *size)
+static void *three_way_filemerge(struct index_state *istate,
+                                const char *path,
+                                mmfile_t *base,
+                                mmfile_t *our,
+                                mmfile_t *their,
+                                unsigned long *size)
 {
        int merge_status;
        mmbuffer_t res;
@@ -42,7 +47,7 @@ static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our
         */
        merge_status = ll_merge(&res, path, base, NULL,
                                our, ".our", their, ".their",
-                               &the_index, NULL);
+                               istate, NULL);
        if (merge_status < 0)
                return NULL;
 
@@ -50,7 +55,9 @@ static void *three_way_filemerge(const char *path, mmfile_t *base, mmfile_t *our
        return res.ptr;
 }
 
-void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct blob *their, unsigned long *size)
+void *merge_blobs(struct index_state *istate, const char *path,
+                 struct blob *base, struct blob *our,
+                 struct blob *their, unsigned long *size)
 {
        void *res = NULL;
        mmfile_t f1, f2, common;
@@ -83,7 +90,7 @@ void *merge_blobs(const char *path, struct blob *base, struct blob *our, struct
                common.ptr = xstrdup("");
                common.size = 0;
        }
-       res = three_way_filemerge(path, &common, &f1, &f2, size);
+       res = three_way_filemerge(istate, path, &common, &f1, &f2, size);
        free_mmfile(&common);
 out_free_f2_f1:
        free_mmfile(&f2);
index 62b569e472450540689bbb0a4d08c1e3cfd89f12..cc31038b807fbee073a063ec83fe298c87fd2b3d 100644 (file)
@@ -1,8 +1,11 @@
 #ifndef MERGE_BLOBS_H
 #define MERGE_BLOBS_H
 
-#include "blob.h"
+struct blob;
+struct index_state;
 
-extern void *merge_blobs(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
+extern void *merge_blobs(struct index_state *, const char *,
+                        struct blob *, struct blob *,
+                        struct blob *, unsigned long *);
 
 #endif /* MERGE_BLOBS_H */