]> git.ipfire.org Git - thirdparty/git.git/blobdiff - range-diff.c
environment.h: move declarations for environment.c functions from cache.h
[thirdparty/git.git] / range-diff.c
index 8255ab4349c009bec7c2c7200365d2bd9b018c16..815fb24c9cef9982c5e3366d4de15ca559d96866 100644 (file)
@@ -1,4 +1,6 @@
 #include "cache.h"
+#include "environment.h"
+#include "gettext.h"
 #include "range-diff.h"
 #include "string-list.h"
 #include "run-command.h"
@@ -383,11 +385,14 @@ static void output_pair_header(struct diff_options *diffopt,
        const char *color_new = diff_get_color_opt(diffopt, DIFF_FILE_NEW);
        const char *color_commit = diff_get_color_opt(diffopt, DIFF_COMMIT);
        const char *color;
+       int abbrev = diffopt->abbrev;
+
+       if (abbrev < 0)
+               abbrev = DEFAULT_ABBREV;
 
        if (!dashes->len)
                strbuf_addchars(dashes, '-',
-                               strlen(find_unique_abbrev(oid,
-                                                         DEFAULT_ABBREV)));
+                               strlen(find_unique_abbrev(oid, abbrev)));
 
        if (!b_util) {
                color = color_old;
@@ -409,7 +414,7 @@ static void output_pair_header(struct diff_options *diffopt,
                strbuf_addf(buf, "%*s:  %s ", patch_no_width, "-", dashes->buf);
        else
                strbuf_addf(buf, "%*d:  %s ", patch_no_width, a_util->i + 1,
-                           find_unique_abbrev(&a_util->oid, DEFAULT_ABBREV));
+                           find_unique_abbrev(&a_util->oid, abbrev));
 
        if (status == '!')
                strbuf_addf(buf, "%s%s", color_reset, color);
@@ -421,7 +426,7 @@ static void output_pair_header(struct diff_options *diffopt,
                strbuf_addf(buf, " %*s:  %s", patch_no_width, "-", dashes->buf);
        else
                strbuf_addf(buf, " %*d:  %s", patch_no_width, b_util->i + 1,
-                           find_unique_abbrev(&b_util->oid, DEFAULT_ABBREV));
+                           find_unique_abbrev(&b_util->oid, abbrev));
 
        commit = lookup_commit_reference(the_repository, oid);
        if (commit) {