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

[PATCHv2 4/9] packfile: add repository argument to packed_to_object_type

From
Stefan Beller <sbeller@google.com>
Date
Apr 24, 2018, 21:59 UTC
Message-ID
<20180424215910.22201-5-sbeller@google.com>
In-Reply-To
<20180424215910.22201-1-sbeller@google.com>

Add a repository argument to allow the callers of packed_to_object_type to be more specific about which repository to handle. This is a small mechanical change; it doesn't change the implementation to handle repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 packfile.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/packfile.c b/packfile.c
index d2b3f3503b..3ecfba66af 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1124,11 +1124,13 @@ static int retry_bad_packed_offset_the_repository(struct packed_git *p, off_t ob
 
 #define POI_STACK_PREALLOC 64
 
-static enum object_type packed_to_object_type(struct packed_git *p,
-					      off_t obj_offset,
-					      enum object_type type,
-					      struct pack_window **w_curs,
-					      off_t curpos)
+#define packed_to_object_type(r, p, o, t, w, c) \
+	packed_to_object_type_##r(p, o, t, w, c)
+static enum object_type packed_to_object_type_the_repository(struct packed_git *p,
+							     off_t obj_offset,
+							     enum object_type type,
+							     struct pack_window **w_curs,
+							     off_t curpos)
 {
 	off_t small_poi_stack[POI_STACK_PREALLOC];
 	off_t *poi_stack = small_poi_stack;
@@ -1378,8 +1380,8 @@ int packed_object_info(struct packed_git *p, off_t obj_offset,
 
 	if (oi->typep || oi->type_name) {
 		enum object_type ptot;
-		ptot = packed_to_object_type(p, obj_offset, type, &w_curs,
-					     curpos);
+		ptot = packed_to_object_type(the_repository, p, obj_offset,
+					     type, &w_curs, curpos);
 		if (oi->typep)
 			*oi->typep = ptot;
 		if (oi->type_name) {
-- 
2.17.0.441.gb46fe60e1d-goog
Previous: Stefan BellerNext: Stefan Beller
Message 5 of 24 in “[PATCHv2 0/9] object store: oid_object_info is the next contender”
  1. Stefan BellerApr 24, 2018
  2. 1/9 cache.h: add repository argument to oid_object_info_extendedStefan Beller, Apr 24, 2018
  3. 2/9 cache.h: add repository argument to oid_object_infoStefan Beller, Apr 24, 2018
  4. 3/9 packfile: add repository argument to retry_bad_packed_offsetStefan Beller, Apr 24, 2018
  5. 4/9 packfile: add repository argument to packed_to_object_typeStefan Beller, Apr 24, 2018
  6. 5/9 packfile: add repository argument to packed_object_infoStefan Beller, Apr 24, 2018
  7. 9/9 cache.h: allow oid_object_info to handle arbitrary repositoriesStefan Beller, Apr 24, 2018
  8. Jonathan TanApr 24, 2018
  9. 8/9 packfile: add repository argument to cache_or_unpack_entryStefan Beller, Apr 24, 2018
  10. 7/9 packfile: add repository argument to unpack_entryStefan Beller, Apr 24, 2018
  11. 6/9 packfile: add repository argument to read_objectStefan Beller, Apr 24, 2018
  12. 9/9 cache.h: allow sha1_object_info to handle arbitrary repositoriesStefan Beller, Apr 24, 2018
  13. 0/9 object store: oid_object_info is the next contenderStefan Beller, Apr 25, 2018
  14. 1/9 cache.h: add repository argument to oid_object_info_extendedStefan Beller, Apr 25, 2018
  15. 3/9 packfile: add repository argument to retry_bad_packed_offsetStefan Beller, Apr 25, 2018
  16. 6/9 packfile: add repository argument to read_objectStefan Beller, Apr 25, 2018
  17. 9/9 cache.h: allow oid_object_info to handle arbitrary repositoriesStefan Beller, Apr 25, 2018
  18. 2/9 cache.h: add repository argument to oid_object_infoStefan Beller, Apr 25, 2018
  19. 5/9 packfile: add repository argument to packed_object_infoStefan Beller, Apr 25, 2018
  20. 4/9 packfile: add repository argument to packed_to_object_typeStefan Beller, Apr 25, 2018
  21. 8/9 packfile: add repository argument to cache_or_unpack_entryStefan Beller, Apr 25, 2018
  22. 7/9 packfile: add repository argument to unpack_entryStefan Beller, Apr 25, 2018
  23. Jonathan TanApr 25, 2018
  24. Brandon WilliamsApr 26, 2018

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.