1
0
mirror of https://github.com/git/git.git synced 2025-04-10 20:44:48 +00:00
git/builtin
Jeff King 7cb5f7c44d 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>
2015-11-24 17:07:04 -05:00
..
2014-07-16 11:10:11 -07:00
2015-11-24 17:07:04 -05:00
2015-06-05 12:17:37 -07:00
2015-01-14 09:32:04 -08:00
2015-06-24 12:21:48 -07:00
2015-07-13 14:02:02 -07:00
2015-03-20 13:11:53 -07:00
2015-06-05 12:17:36 -07:00
2015-01-14 09:32:04 -08:00
2015-01-14 09:32:04 -08:00
2015-07-13 14:02:02 -07:00
2015-05-11 14:23:39 -07:00
2015-01-14 09:32:04 -08:00
2015-01-14 09:32:04 -08:00
2015-09-04 10:43:23 -07:00
2015-07-13 14:02:19 -07:00