]> git.ipfire.org Git - thirdparty/git.git/blobdiff - diff.c
The seventh batch
[thirdparty/git.git] / diff.c
diff --git a/diff.c b/diff.c
index e50def45383eba4af74300802a161bdeeb6c4e8f..ded9ac70df31cce3168d4a01679d54832f3ad5b9 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -62,6 +62,8 @@ static const char *diff_order_file_cfg;
 int diff_auto_refresh_index = 1;
 static int diff_mnemonic_prefix;
 static int diff_no_prefix;
+static const char *diff_src_prefix = "a/";
+static const char *diff_dst_prefix = "b/";
 static int diff_relative;
 static int diff_stat_name_width;
 static int diff_stat_graph_width;
@@ -408,6 +410,12 @@ int git_diff_ui_config(const char *var, const char *value,
                diff_no_prefix = git_config_bool(var, value);
                return 0;
        }
+       if (!strcmp(var, "diff.srcprefix")) {
+               return git_config_string(&diff_src_prefix, var, value);
+       }
+       if (!strcmp(var, "diff.dstprefix")) {
+               return git_config_string(&diff_dst_prefix, var, value);
+       }
        if (!strcmp(var, "diff.relative")) {
                diff_relative = git_config_bool(var, value);
                return 0;
@@ -3425,8 +3433,8 @@ void diff_set_noprefix(struct diff_options *options)
 
 void diff_set_default_prefix(struct diff_options *options)
 {
-       options->a_prefix = "a/";
-       options->b_prefix = "b/";
+       options->a_prefix = diff_src_prefix;
+       options->b_prefix = diff_dst_prefix;
 }
 
 struct userdiff_driver *get_textconv(struct repository *r,
@@ -4547,6 +4555,7 @@ static void run_diff_cmd(const char *pgm,
                             o, complete_rewrite);
        } else {
                fprintf(o->file, "* Unmerged path %s\n", name);
+               o->found_changes = 1;
        }
 }
 
@@ -5362,6 +5371,8 @@ static int diff_opt_default_prefix(const struct option *opt,
 
        BUG_ON_OPT_NEG(unset);
        BUG_ON_OPT_ARG(optarg);
+       diff_src_prefix = "a/";
+       diff_dst_prefix = "b/";
        diff_set_default_prefix(options);
        return 0;
 }