provide a helper to set the commit buffer
Right now this is just a one-liner, but abstracting it will make it easier to change later. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0fb370da9c
commit
66c2827ea4
7
commit.c
7
commit.c
@ -245,6 +245,11 @@ int unregister_shallow(const unsigned char *sha1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_commit_buffer(struct commit *commit, void *buffer)
|
||||
{
|
||||
commit->buffer = buffer;
|
||||
}
|
||||
|
||||
void free_commit_buffer(struct commit *commit)
|
||||
{
|
||||
free(commit->buffer);
|
||||
@ -335,7 +340,7 @@ int parse_commit(struct commit *item)
|
||||
}
|
||||
ret = parse_commit_buffer(item, buffer, size);
|
||||
if (save_commit_buffer && !ret) {
|
||||
item->buffer = buffer;
|
||||
set_commit_buffer(item, buffer);
|
||||
return 0;
|
||||
}
|
||||
free(buffer);
|
||||
|
Reference in New Issue
Block a user