]> git.ipfire.org Git - thirdparty/git.git/blobdiff - commit.c
alloc: allow arbitrary repositories for alloc functions
[thirdparty/git.git] / commit.c
index a9a43e79bae3ced1ea7bd66e09c9f47d8e63997d..5eb4d2f08f8d093e871072035b0ad8024e583cba 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -6,6 +6,7 @@
 #include "diff.h"
 #include "revision.h"
 #include "notes.h"
+#include "alloc.h"
 #include "gpg-interface.h"
 #include "mergesort.h"
 #include "commit-slab.h"
@@ -296,6 +297,17 @@ void free_commit_buffer(struct commit *commit)
        }
 }
 
+void release_commit_memory(struct commit *c)
+{
+       c->tree = NULL;
+       c->index = 0;
+       free_commit_buffer(c);
+       free_commit_list(c->parents);
+       /* TODO: what about commit->util? */
+
+       c->object.parsed = 0;
+}
+
 const void *detach_commit_buffer(struct commit *commit, unsigned long *sizep)
 {
        struct commit_buffer *v = buffer_slab_peek(&buffer_slab, commit);