Teach notes code to free its internal data structures on request
[gitweb.git] / notes.c
diff --git a/notes.c b/notes.c
index b7d79e19005f3c384e8e52795746bffdb20d6e67..a5d888d77250d7d410c55ea2fdab73d1bcfd8795 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -105,6 +105,13 @@ static unsigned char *lookup_notes(const unsigned char *commit_sha1)
        return hash_map.entries[index].notes_sha1;
 }
 
+void free_notes(void)
+{
+       free(hash_map.entries);
+       memset(&hash_map, 0, sizeof(struct hash_map));
+       initialized = 0;
+}
+
 void get_commit_notes(const struct commit *commit, struct strbuf *sb,
                const char *output_encoding, int flags)
 {