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:
authorJeff King <peff@peff.net>2015-11-18 02:22:37 +0300
committerJeff King <peff@peff.net>2015-11-25 01:07:04 +0300
commit7cb5f7c44dfea798a5ad99ee5b42fdaf8de4e379 (patch)
tree1cae58d262b39e43940a4069860f0b802c9e7b17 /t/annotate-tests.sh
parent700fd28e4f3ecd6e7b5f8f2098e62ffef9ab958b (diff)
blame: fix object casting regression
Commit 1b0d400 refactored the prepare_final() function so that it could be reused in multiple places. Originally, the loop had two outputs: a commit to stuff into sb->final, and the name of the commit from the rev->pending array. After the refactor, that loop is put in its own function with a single return value: the object_array_entry from the rev->pending array. This contains both the name and the object, but with one important difference: the object is the _original_ object found by the revision parser, not the dereferenced commit. If one feeds a tag to "git blame", we end up casting the tag object to a "struct commit", which causes a segfault. Instead, let's return the commit (properly casted) directly from the function, and take the "name" as an optional out-parameter. This does the right thing, and actually simplifies the callers, who no longer need to cast or dereference the object_array_entry themselves. [test case by Max Kirillov <max@max630.net>] Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 't/annotate-tests.sh')
-rw-r--r--t/annotate-tests.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index b1673b3e8f..093832fef1 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -68,6 +68,13 @@ test_expect_success 'blame 1 author' '
check_count A 2
'
+test_expect_success 'blame by tag objects' '
+ git tag -m "test tag" testTag &&
+ git tag -m "test tag #2" testTag2 testTag &&
+ check_count -h testTag A 2 &&
+ check_count -h testTag2 A 2
+'
+
test_expect_success 'setup B lines' '
echo "2A quick brown fox jumps over the" >>file &&
echo "lazy dog" >>file &&