provide a helper to free commit buffer
[gitweb.git] / commit.c
index fbdc480ccf17b4d241e0a950e8dd44dfe9d684ce..11a05c1f24f541fa3495adc502cb292c3891fab4 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -245,6 +245,19 @@ int unregister_shallow(const unsigned char *sha1)
        return 0;
 }
 
+void free_commit_buffer(struct commit *commit)
+{
+       free(commit->buffer);
+       commit->buffer = NULL;
+}
+
+const void *detach_commit_buffer(struct commit *commit)
+{
+       void *ret = commit->buffer;
+       commit->buffer = NULL;
+       return ret;
+}
+
 int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size)
 {
        const char *tail = buffer;