]> git.ipfire.org Git - thirdparty/git.git/blobdiff - ll-merge.c
Merge branch 'en/merge-path-collision'
[thirdparty/git.git] / ll-merge.c
index aabc1b5c2e29e25c92c224cc3b58d910f11603d3..5b8d46aedee72aab8b027cf4310b4234268965b6 100644 (file)
@@ -336,10 +336,10 @@ static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr
        return &ll_merge_drv[LL_TEXT_MERGE];
 }
 
-static void normalize_file(mmfile_t *mm, const char *path)
+static void normalize_file(mmfile_t *mm, const char *path, struct index_state *istate)
 {
        struct strbuf strbuf = STRBUF_INIT;
-       if (renormalize_buffer(&the_index, path, mm->ptr, mm->size, &strbuf)) {
+       if (renormalize_buffer(istate, path, mm->ptr, mm->size, &strbuf)) {
                free(mm->ptr);
                mm->size = strbuf.len;
                mm->ptr = strbuf_detach(&strbuf, NULL);
@@ -351,6 +351,7 @@ int ll_merge(mmbuffer_t *result_buf,
             mmfile_t *ancestor, const char *ancestor_label,
             mmfile_t *ours, const char *our_label,
             mmfile_t *theirs, const char *their_label,
+            struct index_state *istate,
             const struct ll_merge_options *opts)
 {
        static struct attr_check *check;
@@ -363,21 +364,20 @@ int ll_merge(mmbuffer_t *result_buf,
                opts = &default_opts;
 
        if (opts->renormalize) {
-               normalize_file(ancestor, path);
-               normalize_file(ours, path);
-               normalize_file(theirs, path);
+               normalize_file(ancestor, path, istate);
+               normalize_file(ours, path, istate);
+               normalize_file(theirs, path, istate);
        }
 
        if (!check)
                check = attr_check_initl("merge", "conflict-marker-size", NULL);
 
-       if (!git_check_attr(&the_index, path, check)) {
-               ll_driver_name = check->items[0].value;
-               if (check->items[1].value) {
-                       marker_size = atoi(check->items[1].value);
-                       if (marker_size <= 0)
-                               marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
-               }
+       git_check_attr(istate, path, check);
+       ll_driver_name = check->items[0].value;
+       if (check->items[1].value) {
+               marker_size = atoi(check->items[1].value);
+               if (marker_size <= 0)
+                       marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
        }
        driver = find_ll_merge_driver(ll_driver_name);
 
@@ -393,14 +393,15 @@ int ll_merge(mmbuffer_t *result_buf,
                          opts, marker_size);
 }
 
-int ll_merge_marker_size(const char *path)
+int ll_merge_marker_size(struct index_state *istate, const char *path)
 {
        static struct attr_check *check;
        int marker_size = DEFAULT_CONFLICT_MARKER_SIZE;
 
        if (!check)
                check = attr_check_initl("conflict-marker-size", NULL);
-       if (!git_check_attr(&the_index, path, check) && check->items[0].value) {
+       git_check_attr(istate, path, check);
+       if (check->items[0].value) {
                marker_size = atoi(check->items[0].value);
                if (marker_size <= 0)
                        marker_size = DEFAULT_CONFLICT_MARKER_SIZE;