summaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-10 23:40:14 +0200
committerJunio C Hamano <gitster@pobox.com>2014-06-13 21:08:17 +0200
commit66c2827ea4deb24ff541e30a5b6239ad5e9f6801 (patch)
treef18ee239e5cfe24ad5fed70b3e4836fe2aa63384 /commit.c
parentprovide a helper to free commit buffer (diff)
downloadgit-66c2827ea4deb24ff541e30a5b6239ad5e9f6801.tar.xz
git-66c2827ea4deb24ff541e30a5b6239ad5e9f6801.zip
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 11a05c1f24..fc8b4e287d 100644
--- a/commit.c
+++ b/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);