]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/blame.c
Merge branch 'js/update-index-ignore-removal-for-skip-worktree'
[thirdparty/git.git] / builtin / blame.c
index b6534d4dea9ad81a34eaf099f7cf9a0a1e56f410..10185ccdc65e04f6b716194631073ccfff7afa50 100644 (file)
@@ -26,7 +26,6 @@
 #include "progress.h"
 #include "object-store.h"
 #include "blame.h"
-#include "string-list.h"
 #include "refs.h"
 
 static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
@@ -320,18 +319,18 @@ static const char *format_time(timestamp_t time, const char *tz_str,
        return time_buf.buf;
 }
 
-#define OUTPUT_ANNOTATE_COMPAT 001
-#define OUTPUT_LONG_OBJECT_NAME        002
-#define OUTPUT_RAW_TIMESTAMP   004
-#define OUTPUT_PORCELAIN       010
-#define OUTPUT_SHOW_NAME       020
-#define OUTPUT_SHOW_NUMBER     040
-#define OUTPUT_SHOW_SCORE      0100
-#define OUTPUT_NO_AUTHOR       0200
-#define OUTPUT_SHOW_EMAIL      0400
-#define OUTPUT_LINE_PORCELAIN  01000
-#define OUTPUT_COLOR_LINE      02000
-#define OUTPUT_SHOW_AGE_WITH_COLOR     04000
+#define OUTPUT_ANNOTATE_COMPAT      (1U<<0)
+#define OUTPUT_LONG_OBJECT_NAME     (1U<<1)
+#define OUTPUT_RAW_TIMESTAMP        (1U<<2)
+#define OUTPUT_PORCELAIN            (1U<<3)
+#define OUTPUT_SHOW_NAME            (1U<<4)
+#define OUTPUT_SHOW_NUMBER          (1U<<5)
+#define OUTPUT_SHOW_SCORE           (1U<<6)
+#define OUTPUT_NO_AUTHOR            (1U<<7)
+#define OUTPUT_SHOW_EMAIL           (1U<<8)
+#define OUTPUT_LINE_PORCELAIN       (1U<<9)
+#define OUTPUT_COLOR_LINE           (1U<<10)
+#define OUTPUT_SHOW_AGE_WITH_COLOR  (1U<<11)
 
 static void emit_porcelain_details(struct blame_origin *suspect, int repeat)
 {
@@ -460,7 +459,7 @@ static void emit_other(struct blame_scoreboard *sb, struct blame_entry *ent, int
 
        for (cnt = 0; cnt < ent->num_lines; cnt++) {
                char ch;
-               int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? GIT_SHA1_HEXSZ : abbrev;
+               int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? the_hash_algo->hexsz : abbrev;
 
                if (opt & OUTPUT_COLOR_LINE) {
                        if (cnt > 0) {
@@ -885,6 +884,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
        struct range_set ranges;
        unsigned int range_i;
        long anchor;
+       const int hexsz = the_hash_algo->hexsz;
 
        setup_default_color_by_age();
        git_config(git_blame_config, &output_option);
@@ -931,11 +931,11 @@ parse_done:
        } else if (show_progress < 0)
                show_progress = isatty(2);
 
-       if (0 < abbrev && abbrev < GIT_SHA1_HEXSZ)
+       if (0 < abbrev && abbrev < hexsz)
                /* one more abbrev length is needed for the boundary commit */
                abbrev++;
        else if (!abbrev)
-               abbrev = GIT_SHA1_HEXSZ;
+               abbrev = hexsz;
 
        if (revs_file && read_ancestry(revs_file))
                die_errno("reading graft file '%s' failed", revs_file);