Skip to content

Commit f4a7c24

Browse files
committed
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
2 parents f9712d7 + 835950b commit f4a7c24

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

blame.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2806,7 +2806,9 @@ void setup_scoreboard(struct blame_scoreboard *sb,
28062806
parent_oid = &head_oid;
28072807
}
28082808

2809-
setup_work_tree();
2809+
if (!sb->contents_from)
2810+
setup_work_tree();
2811+
28102812
sb->final = fake_working_tree_commit(sb->repo,
28112813
&sb->revs->diffopt,
28122814
sb->path, sb->contents_from,

t/annotate-tests.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ test_expect_success 'blame with --contents' '
8383
check_count --contents=file A 2
8484
'
8585

86+
test_expect_success 'blame with --contents in a bare repo' '
87+
git clone --bare . bare-contents.git &&
88+
(
89+
cd bare-contents.git &&
90+
echo "1A quick brown fox jumps over the" >contents &&
91+
check_count --contents=contents A 1
92+
)
93+
'
94+
8695
test_expect_success 'blame with --contents changed' '
8796
echo "1A quick brown fox jumps over the" >contents &&
8897
echo "another lazy dog" >>contents &&

0 commit comments

Comments
 (0)