ll-merge.c: remove implicit dependency on the_index
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index e5d6d30a676aacf7a8ee1888d208582765630183..a06c3b070c698f4b612124cd07f066461e17f123 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1700,8 +1700,8 @@ static void emit_rewrite_diff(const char *name_a,
        quote_two_c_style(&a_name, a_prefix, name_a, 0);
        quote_two_c_style(&b_name, b_prefix, name_b, 0);
 
-       size_one = fill_textconv(textconv_one, one, &data_one);
-       size_two = fill_textconv(textconv_two, two, &data_two);
+       size_one = fill_textconv(o->repo, textconv_one, one, &data_one);
+       size_two = fill_textconv(o->repo, textconv_two, two, &data_two);
 
        memset(&ecbdata, 0, sizeof(ecbdata));
        ecbdata.color_diff = want_color(o->use_color);
@@ -3462,8 +3462,8 @@ static void builtin_diff(const char *name_a,
                        strbuf_reset(&header);
                }
 
-               mf1.size = fill_textconv(textconv_one, one, &mf1.ptr);
-               mf2.size = fill_textconv(textconv_two, two, &mf2.ptr);
+               mf1.size = fill_textconv(o->repo, textconv_one, one, &mf1.ptr);
+               mf2.size = fill_textconv(o->repo, textconv_two, two, &mf2.ptr);
 
                pe = diff_funcname_pattern(one);
                if (!pe)
@@ -3637,7 +3637,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
        data.lineno = 0;
        data.o = o;
        data.ws_rule = whitespace_rule(attr_path);
-       data.conflict_marker_size = ll_merge_marker_size(attr_path);
+       data.conflict_marker_size = ll_merge_marker_size(o->repo->index, attr_path);
 
        if (fill_mmfile(o->repo, &mf1, one) < 0 ||
            fill_mmfile(o->repo, &mf2, two) < 0)
@@ -4390,12 +4390,12 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o)
        builtin_checkdiff(name, other, attr_path, p->one, p->two, o);
 }
 
-void diff_setup(struct diff_options *options)
+void repo_diff_setup(struct repository *r, struct diff_options *options)
 {
        memcpy(options, &default_diff_options, sizeof(*options));
 
        options->file = stdout;
-       options->repo->index = &the_index;
+       options->repo = r;
 
        options->abbrev = DEFAULT_ABBREV;
        options->line_termination = '\n';
@@ -6337,11 +6337,11 @@ static char *run_textconv(struct repository *r,
        return strbuf_detach(&buf, outsize);
 }
 
-size_t fill_textconv(struct userdiff_driver *driver,
+size_t fill_textconv(struct repository *r,
+                    struct userdiff_driver *driver,
                     struct diff_filespec *df,
                     char **outbuf)
 {
-       struct repository *r = the_repository;
        size_t size;
 
        if (!driver) {
@@ -6386,7 +6386,8 @@ size_t fill_textconv(struct userdiff_driver *driver,
        return size;
 }
 
-int textconv_object(const char *path,
+int textconv_object(struct repository *r,
+                   const char *path,
                    unsigned mode,
                    const struct object_id *oid,
                    int oid_valid,
@@ -6404,7 +6405,7 @@ int textconv_object(const char *path,
                return 0;
        }
 
-       *buf_size = fill_textconv(textconv, df, buf);
+       *buf_size = fill_textconv(r, textconv, df, buf);
        free_filespec(df);
        return 1;
 }