diff options
-rw-r--r-- | builtin/blame.c | 1 | ||||
-rwxr-xr-x | t/t8003-blame-corner-cases.sh | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 048ed53c2f..a5cabf79ea 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2275,6 +2275,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, unsigned mode; struct strbuf msg = STRBUF_INIT; + read_cache(); time(&now); commit = alloc_commit_node(); commit->object.parsed = 1; diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh index 16f1442c1e..b8128b6334 100755 --- a/t/t8003-blame-corner-cases.sh +++ b/t/t8003-blame-corner-cases.sh @@ -212,4 +212,18 @@ test_expect_success 'blame file with CRLF attributes text' ' grep "A U Thor" actual ' +test_expect_success 'blame file with CRLF core.autocrlf=true' ' + git config core.autocrlf false && + printf "testcase\r\n" >crlfinrepo && + >.gitattributes && + git add crlfinrepo && + git commit -m "add crlfinrepo" && + git config core.autocrlf true && + mv crlfinrepo tmp && + git checkout crlfinrepo && + rm tmp && + git blame crlfinrepo >actual && + grep "A U Thor" actual +' + test_done |