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

[PATCH 1/2] pack-objects: refactor to oid_object_info_extended

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jul 21, 2020, 00:21 UTC
Message-ID
<1c32a00601b0cb3c48807d56fb34b10df5373e81.1595290841.git.jonathantanmy@google.com>
In-Reply-To
<cover.1595290841.git.jonathantanmy@google.com>

Use oid_object_info_extended() instead of oid_object_info() because a subsequent commit needs to specify an additional flag here.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 builtin/pack-objects.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 7016b28485..e09d140eed 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1707,6 +1707,8 @@ static int can_reuse_delta(const struct object_id *base_oid,
 static void check_object(struct object_entry *entry)
 {
 	unsigned long canonical_size;
+	enum object_type type;
+	struct object_info oi = {.typep = &type, .sizep = &canonical_size};
 
 	if (IN_PACK(entry)) {
 		struct packed_git *p = IN_PACK(entry);
@@ -1840,8 +1842,10 @@ static void check_object(struct object_entry *entry)
 		unuse_pack(&w_curs);
 	}
 
-	oe_set_type(entry,
-		    oid_object_info(the_repository, &entry->idx.oid, &canonical_size));
+	if (oid_object_info_extended(the_repository, &entry->idx.oid, &oi,
+				     OBJECT_INFO_LOOKUP_REPLACE) < 0)
+		type = -1;
+	oe_set_type(entry, type);
 	if (entry->type_valid) {
 		SET_SIZE(entry, canonical_size);
 	} else {
-- 
2.28.0.rc0.105.gf9edc3c819-goog
Previous: Junio C Hamano
Message 13 of 13 in “Prefetch objects in pack-objects”
  1. 0/2 Prefetch objects in pack-objectsJonathan Tan, Jul 21, 2020
  2. 2/2 pack-objects: prefetch objects to be packedJonathan Tan, Jul 21, 2020
  3. Junio C HamanoJul 21, 2020
  4. Jonathan TanJul 21, 2020
  5. Junio C HamanoJul 21, 2020
  6. Junio C HamanoJul 21, 2020
  7. Jonathan TanJul 21, 2020
  8. Junio C HamanoJul 21, 2020
  9. Jonathan TanJul 21, 2020
  10. Junio C HamanoJul 21, 2020
  11. Jonathan TanJul 22, 2020
  12. Junio C HamanoJul 22, 2020
  13. 1/2 pack-objects: refactor to oid_object_info_extendedJonathan Tan, Jul 21, 2020

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.