Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blame.c4
-rw-r--r--t/annotate-tests.sh9
2 files changed, 12 insertions, 1 deletions
diff --git a/blame.c b/blame.c
index d12bd9f97b..141756975b 100644
--- a/blame.c
+++ b/blame.c
@@ -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,
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index 2ef70235b1..5e21e84f38 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -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 &&