pack-check.c: remove the_repository references
[gitweb.git] / diff.c
diff --git a/diff.c b/diff.c
index 96833c8e81b5d6a7babb523c7ceec0e22ccdab33..1135377a7f09c7462bf6cf0c4a8906055c90426d 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1217,10 +1217,11 @@ static void dim_moved_lines(struct diff_options *o)
 static void emit_line_ws_markup(struct diff_options *o,
                                const char *set_sign, const char *set,
                                const char *reset,
-                               char sign, const char *line, int len,
+                               int sign_index, const char *line, int len,
                                unsigned ws_rule, int blank_at_eof)
 {
        const char *ws = NULL;
+       int sign = o->output_indicators[sign_index];
 
        if (o->ws_error_highlight & ws_rule) {
                ws = diff_get_color_opt(o, DIFF_WHITESPACE);
@@ -1300,8 +1301,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
                                set = diff_get_color_opt(o, DIFF_FILE_OLD);
                }
                emit_line_ws_markup(o, set_sign, set, reset,
-                                   o->output_indicators[OUTPUT_INDICATOR_CONTEXT],
-                                   line, len,
+                                   OUTPUT_INDICATOR_CONTEXT, line, len,
                                    flags & (DIFF_SYMBOL_CONTENT_WS_MASK), 0);
                break;
        case DIFF_SYMBOL_PLUS:
@@ -1345,8 +1345,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
                        flags &= ~DIFF_SYMBOL_CONTENT_WS_MASK;
                }
                emit_line_ws_markup(o, set_sign, set, reset,
-                                   o->output_indicators[OUTPUT_INDICATOR_NEW],
-                                   line, len,
+                                   OUTPUT_INDICATOR_NEW, line, len,
                                    flags & DIFF_SYMBOL_CONTENT_WS_MASK,
                                    flags & DIFF_SYMBOL_CONTENT_BLANK_LINE_EOF);
                break;
@@ -1390,8 +1389,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
                                set = diff_get_color_opt(o, DIFF_CONTEXT_DIM);
                }
                emit_line_ws_markup(o, set_sign, set, reset,
-                                   o->output_indicators[OUTPUT_INDICATOR_OLD],
-                                   line, len,
+                                   OUTPUT_INDICATOR_OLD, line, len,
                                    flags & DIFF_SYMBOL_CONTENT_WS_MASK, 0);
                break;
        case DIFF_SYMBOL_WORDS_PORCELAIN:
@@ -3314,14 +3312,14 @@ void diff_set_mnemonic_prefix(struct diff_options *options, const char *a, const
                options->b_prefix = b;
 }
 
-struct userdiff_driver *get_textconv(struct index_state *istate,
+struct userdiff_driver *get_textconv(struct repository *r,
                                     struct diff_filespec *one)
 {
        if (!DIFF_FILE_VALID(one))
                return NULL;
 
-       diff_filespec_load_driver(one, istate);
-       return userdiff_get_textconv(one->driver);
+       diff_filespec_load_driver(one, r->index);
+       return userdiff_get_textconv(r, one->driver);
 }
 
 static void builtin_diff(const char *name_a,
@@ -3370,8 +3368,8 @@ static void builtin_diff(const char *name_a,
        }
 
        if (o->flags.allow_textconv) {
-               textconv_one = get_textconv(o->repo->index, one);
-               textconv_two = get_textconv(o->repo->index, two);
+               textconv_one = get_textconv(o->repo, one);
+               textconv_two = get_textconv(o->repo, two);
        }
 
        /* Never use a non-valid filename anywhere if at all possible */
@@ -4304,12 +4302,12 @@ static void diff_fill_oid_info(struct diff_filespec *one, struct index_state *is
 static void strip_prefix(int prefix_length, const char **namep, const char **otherp)
 {
        /* Strip the prefix but do not molest /dev/null and absolute paths */
-       if (*namep && **namep != '/') {
+       if (*namep && !is_absolute_path(*namep)) {
                *namep += prefix_length;
                if (**namep == '/')
                        ++*namep;
        }
-       if (*otherp && **otherp != '/') {
+       if (*otherp && !is_absolute_path(*otherp)) {
                *otherp += prefix_length;
                if (**otherp == '/')
                        ++*otherp;
@@ -6438,7 +6436,7 @@ int textconv_object(struct repository *r,
 
        df = alloc_filespec(path);
        fill_filespec(df, oid, oid_valid, mode);
-       textconv = get_textconv(r->index, df);
+       textconv = get_textconv(r, df);
        if (!textconv) {
                free_filespec(df);
                return 0;