Merge branch 'hy/blame-in-bare-with-contents'

"git blame --contents=file" has been taught to work in a bare
repository.

* hy/blame-in-bare-with-contents:
  blame: allow --contents to work with bare repo
This commit is contained in:
Junio C Hamano
2023-08-04 10:52:31 -07:00
2 changed files with 12 additions and 1 deletions

View File

@@ -2806,7 +2806,9 @@ void setup_scoreboard(struct blame_scoreboard *sb,
parent_oid = &head_oid;
}
setup_work_tree();
if (!sb->contents_from)
setup_work_tree();
sb->final = fake_working_tree_commit(sb->repo,
&sb->revs->diffopt,
sb->path, sb->contents_from,

View File

@@ -83,6 +83,15 @@ test_expect_success 'blame with --contents' '
check_count --contents=file A 2
'
test_expect_success 'blame with --contents in a bare repo' '
git clone --bare . bare-contents.git &&
(
cd bare-contents.git &&
echo "1A quick brown fox jumps over the" >contents &&
check_count --contents=contents A 1
)
'
test_expect_success 'blame with --contents changed' '
echo "1A quick brown fox jumps over the" >contents &&
echo "another lazy dog" >>contents &&