diff --git a/builtin/blame.c b/builtin/blame.c index cbb7dc2ad9..1fccbe6bff 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2609,6 +2609,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) if (0 < abbrev && abbrev < GIT_SHA1_HEXSZ) /* one more abbrev length is needed for the boundary commit */ abbrev++; + else if (!abbrev) + abbrev = GIT_SHA1_HEXSZ; if (revs_file && read_ancestry(revs_file)) die_errno("reading graft file '%s' failed", revs_file); diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index c6347ad8fd..380e1c1054 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -114,4 +114,8 @@ test_expect_success 'blame --abbrev=40 behaves like -l' ' check_abbrev 39 --abbrev=40 ^HEAD ' +test_expect_success '--no-abbrev works like --abbrev=40' ' + check_abbrev 40 --no-abbrev +' + test_done