git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>, Jonathan Nieder <jrnieder@gmail.com>
Subject: [PATCH 3/9] packfile: add repository argument to retry_bad_packed_offset
Date: Mon, 23 Apr 2018 16:43:21 -0700	[thread overview]
Message-ID: <20180423234327.250484-4-sbeller@google.com> (raw)
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


  parent reply	other threads:[~2018-04-23 23:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 23:43 [PATCH 0/9] object store: oid_object_info is the next contender Stefan Beller
2018-04-23 23:43 ` [PATCH 1/9] cache.h: add repository argument to oid_object_info_extended Stefan Beller
2018-04-23 23:43 ` [PATCH 2/9] cache.h: add repository argument to oid_object_info Stefan Beller
2018-04-24  0:31   ` brian m. carlson
2018-04-24 18:15   ` Jonathan Tan
2018-04-23 23:43 ` Stefan Beller [this message]
2018-04-23 23:43 ` [PATCH 4/9] packfile: add repository argument to packed_to_object_type Stefan Beller
2018-04-23 23:43 ` [PATCH 5/9] packfile: add repository argument to packed_object_info Stefan Beller
2018-04-24 18:16   ` Jonathan Tan
2018-04-25  0:21     ` Junio C Hamano
2018-04-23 23:43 ` [PATCH 6/9] packfile: add repository argument to read_object Stefan Beller
2018-04-23 23:43 ` [PATCH 7/9] packfile: add repository argument to unpack_entry Stefan Beller
2018-04-23 23:43 ` [PATCH 8/9] packfile: add repository argument to cache_or_unpack_entry Stefan Beller
2018-04-23 23:43 ` [PATCH 9/9] cache.h: allow sha1_object_info to handle arbitrary repositories Stefan Beller
2018-04-24  0:34   ` brian m. carlson
2018-04-24  0:38     ` Stefan Beller
2018-04-24 18:23   ` Jonathan Tan
2018-04-24 18:42     ` Brandon Williams
2018-04-24 18:55       ` Jonathan Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180423234327.250484-4-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).