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

[PATCH 3/9] packfile: add repository argument to retry_bad_packed_offset

From
Stefan Beller <sbeller@google.com>
Date
Apr 23, 2018, 23:43 UTC
Message-ID
<20180423234327.250484-4-sbeller@google.com>
In-Reply-To
<20180423234327.250484-1-sbeller@google.com>

Add a repository argument to allow the callers of retry_bad_packed_offset 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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/packfile.c b/packfile.c
index 80c7fa734f..d2b3f3503b 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1104,7 +1104,9 @@ static const unsigned char *get_delta_base_sha1(struct packed_git *p,
 		return NULL;
 }
 
-static int retry_bad_packed_offset(struct packed_git *p, off_t obj_offset)
+#define retry_bad_packed_offset(r, p, o) \
+	retry_bad_packed_offset_##r(p, o)
+static int retry_bad_packed_offset_the_repository(struct packed_git *p, off_t obj_offset)
 {
 	int type;
 	struct revindex_entry *revidx;
@@ -1153,7 +1155,7 @@ static enum object_type packed_to_object_type(struct packed_git *p,
 		if (type <= OBJ_NONE) {
 			/* If getting the base itself fails, we first
 			 * retry the base, otherwise unwind */
-			type = retry_bad_packed_offset(p, base_offset);
+			type = retry_bad_packed_offset(the_repository, p, base_offset);
 			if (type > OBJ_NONE)
 				goto out;
 			goto unwind;
@@ -1181,7 +1183,7 @@ static enum object_type packed_to_object_type(struct packed_git *p,
 unwind:
 	while (poi_stack_nr) {
 		obj_offset = poi_stack[--poi_stack_nr];
-		type = retry_bad_packed_offset(p, obj_offset);
+		type = retry_bad_packed_offset(the_repository, p, obj_offset);
 		if (type > OBJ_NONE)
 			goto out;
 	}
-- 
2.17.0.484.g0c8726318c-goog
Previous: Jonathan TanNext: Stefan Beller
Message 6 of 19 in “object store: oid_object_info is the next contender”
  1. 0/9 object store: oid_object_info is the next contenderStefan Beller, Apr 23, 2018
  2. 1/9 cache.h: add repository argument to oid_object_info_extendedStefan Beller, Apr 23, 2018
  3. 2/9 cache.h: add repository argument to oid_object_infoStefan Beller, Apr 23, 2018
  4. brian m. carlsonApr 24, 2018
  5. Jonathan TanApr 24, 2018
  6. 3/9 packfile: add repository argument to retry_bad_packed_offsetStefan Beller, Apr 23, 2018
  7. 6/9 packfile: add repository argument to read_objectStefan Beller, Apr 23, 2018
  8. 5/9 packfile: add repository argument to packed_object_infoStefan Beller, Apr 23, 2018
  9. Jonathan TanApr 24, 2018
  10. Junio C HamanoApr 25, 2018
  11. 4/9 packfile: add repository argument to packed_to_object_typeStefan Beller, Apr 23, 2018
  12. 7/9 packfile: add repository argument to unpack_entryStefan Beller, Apr 23, 2018
  13. 8/9 packfile: add repository argument to cache_or_unpack_entryStefan Beller, Apr 23, 2018
  14. 9/9 cache.h: allow sha1_object_info to handle arbitrary repositoriesStefan Beller, Apr 23, 2018
  15. brian m. carlsonApr 24, 2018
  16. Stefan BellerApr 24, 2018
  17. Jonathan TanApr 24, 2018
  18. Brandon WilliamsApr 24, 2018
  19. Jonathan TanApr 24, 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.