git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 04/16] Allow to invalidate a commit in in-memory object store

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jul 31, 2010, 16:18 UTC
Message-ID
<1280593105-22015-5-git-send-email-pclouds@gmail.com>
In-Reply-To
<1280593105-22015-1-git-send-email-pclouds@gmail.com>
This is needed if replacing object happens at run time.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 commit.c |   15 +++++++++++++++
 commit.h |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/commit.c b/commit.c
index e9b0750..d1e30b2 100644
--- a/commit.c
+++ b/commit.c
@@ -315,6 +315,21 @@ int parse_commit(struct commit *item)
 	return ret;
 }
 
+int invalidate_commit(struct commit *item)
+{
+	if (!item)
+		return -1;
+
+	if (item->object.parsed) {
+		item->object.parsed = 0;
+		if (item->buffer) {
+			free(item->buffer);
+			item->buffer = NULL;
+		}
+	}
+	return 0;
+}
+
 struct commit_list *commit_list_insert(struct commit *item, struct commit_list **list_p)
 {
 	struct commit_list *new_list = xmalloc(sizeof(struct commit_list));
diff --git a/commit.h b/commit.h
index eb2b8ac..d8c01ea 100644
--- a/commit.h
+++ b/commit.h
@@ -41,6 +41,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
 
 int parse_commit(struct commit *item);
 
+int invalidate_commit(struct commit *item);
+
 struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
 unsigned commit_list_count(const struct commit_list *l);
 struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
-- 
1.7.1.rc1.69.g24c2f7
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 9 of 33 in “Subtree clone proof of concept”
  1. 00/16 Subtree clone proof of conceptNguyễn Thái Ngọc Duy, Jul 31, 2010
  2. 01/16 Add core.subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  3. 02/16 list-objects: limit traversing within the given subtree if core.subtree is setNguyễn Thái Ngọc Duy, Jul 31, 2010
  4. Ævar Arnfjörð BjarmasonAug 1, 2010
  5. Nguyen Thai Ngoc DuyAug 1, 2010
  6. Elijah NewrenAug 2, 2010
  7. Nguyen Thai Ngoc DuyAug 2, 2010
  8. 03/16 parse_object: keep sha1 even when parsing replaced oneNguyễn Thái Ngọc Duy, Jul 31, 2010
  9. 04/16 Allow to invalidate a commit in in-memory object storeNguyễn Thái Ngọc Duy, Jul 31, 2010
  10. 05/16 Hook up replace-object to allow bulk commit replacementNguyễn Thái Ngọc Duy, Jul 31, 2010
  11. Junio C HamanoAug 2, 2010
  12. Nguyen Thai Ngoc DuyAug 2, 2010
  13. 06/16 upload-pack: use a separate variable to control whether internal rev-list is usedNguyễn Thái Ngọc Duy, Jul 31, 2010
  14. Elijah NewrenAug 2, 2010
  15. 07/16 upload-pack: support subtree packNguyễn Thái Ngọc Duy, Jul 31, 2010
  16. Elijah NewrenAug 2, 2010
  17. 08/16 fetch-pack: support --subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  18. 09/16 subtree: rewrite incoming commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  19. Elijah NewrenAug 2, 2010
  20. 10/16 clone: support subtree clone with parameter --subtreeNguyễn Thái Ngọc Duy, Jul 31, 2010
  21. 11/16 pack-objects: add --subtree (for pushing)Nguyễn Thái Ngọc Duy, Jul 31, 2010
  22. 12/16 subtree: rewriting outgoing commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  23. Elijah NewrenAug 2, 2010
  24. 13/16 Update commit_tree() interface to take base tree tooNguyễn Thái Ngọc Duy, Jul 31, 2010
  25. 14/16 commit_tree(): rewriting/replacing new commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  26. 15/16 commit: rewrite outgoing commitsNguyễn Thái Ngọc Duy, Jul 31, 2010
  27. 16/16 do not use thin packs and subtree together (just a bad feeling about this)Nguyễn Thái Ngọc Duy, Jul 31, 2010
  28. Sverre RabbelierAug 1, 2010
  29. Nguyen Thai Ngoc DuyAug 1, 2010
  30. Sverre RabbelierAug 1, 2010
  31. Elijah NewrenAug 2, 2010
  32. Nguyen Thai Ngoc DuyAug 2, 2010
  33. Nguyen Thai Ngoc DuyAug 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.