diff options
author | Jeff King <peff@peff.net> | 2013-01-26 04:44:06 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-26 13:28:21 -0800 |
commit | dd0d388c44c28ebc021a24eeddc60287d4ea249c (patch) | |
tree | c2899c33f7bebae72fcc57d5d120a781a63b8ac5 /t/t1012-read-tree-df.sh | |
parent | commit: drop useless xstrdup of commit message (diff) | |
download | tgif-dd0d388c44c28ebc021a24eeddc60287d4ea249c.tar.xz |
logmsg_reencode: never return NULL
The logmsg_reencode function will return the reencoded
commit buffer, or NULL if reencoding failed or no reencoding
was necessary. Since every caller then ends up checking for NULL
and just using the commit's original buffer, anyway, we can
be a bit more helpful and just return that buffer when we
would have returned NULL.
Since the resulting string may or may not need to be freed,
we introduce a logmsg_free, which checks whether the buffer
came from the commit object or not (callers either
implemented the same check already, or kept two separate
pointers, one to mark the buffer to be used, and one for the
to-be-freed string).
Pushing this logic into logmsg_* simplifies the callers, and
will let future patches lazily load the commit buffer in a
single place.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1012-read-tree-df.sh')
0 files changed, 0 insertions, 0 deletions