Add custom memory allocator to MinGW and MacOS builds
[gitweb.git] / commit.c
index cf72143f58346c93879a98709d5d6fa8a0981b40..8f6b703c557599921d890c3b50b66eaa397de548 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -5,7 +5,6 @@
 #include "utf8.h"
 #include "diff.h"
 #include "revision.h"
-#include "notes.h"
 
 int save_commit_buffer = 1;
 
@@ -317,6 +316,26 @@ int parse_commit(struct commit *item)
        return ret;
 }
 
+static void unparse_commit_list(struct commit_list *list)
+{
+       for (; list; list = list->next)
+               unparse_commit(list->item);
+}
+
+void unparse_commit(struct commit *item)
+{
+       item->object.flags = 0;
+       item->object.used = 0;
+       if (item->object.parsed) {
+               item->object.parsed = 0;
+               if (item->parents) {
+                       unparse_commit_list(item->parents);
+                       free_commit_list(item->parents);
+                       item->parents = NULL;
+               }
+       }
+}
+
 struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p)
 {
        struct commit_list *new_list = xmalloc(sizeof(struct commit_list));