Skip to content

Commit

Permalink
builtin/blame: switch uses of GIT_SHA1_HEXSZ to the_hash_algo
Browse files Browse the repository at this point in the history
Switch several uses of GIT_SHA1_HEXSZ to the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
bk2204 authored and gitster committed Aug 19, 2019
1 parent fabec2c commit 3190096
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions builtin/blame.c
Expand Up @@ -460,7 +460,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) {
Expand Down Expand Up @@ -885,6 +885,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);
Expand Down Expand Up @@ -931,11 +932,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
} 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);
Expand Down

0 comments on commit 3190096

Please sign in to comment.