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: Jonathan Nieder <jrnieder@gmail.com>, Stefan Beller <sbeller@google.com>
Subject: [PATCH 5/9] packfile: add repository argument to packed_object_info
Date: Mon, 23 Apr 2018 16:43:23 -0700	[thread overview]
Message-ID: <20180423234327.250484-6-sbeller@google.com> (raw)
In-Reply-To: <20180423234327.250484-1-sbeller@google.com>

From: Jonathan Nieder <jrnieder@gmail.com>

Add a repository argument to allow callers of packed_object_info 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>
---
 builtin/pack-objects.c | 3 ++-
 packfile.c             | 4 ++--
 packfile.h             | 3 ++-
 sha1_file.c            | 3 ++-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8d4111f748..d65eb4a947 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1572,7 +1572,8 @@ static void drop_reused_delta(struct object_entry *entry)
 
 	oi.sizep = &entry->size;
 	oi.typep = &entry->type;
-	if (packed_object_info(entry->in_pack, entry->in_pack_offset, &oi) < 0) {
+	if (packed_object_info(the_repository, entry->in_pack,
+			       entry->in_pack_offset, &oi) < 0) {
 		/*
 		 * We failed to get the info from this pack for some reason;
 		 * fall back to sha1_object_info, which may find another copy.
diff --git a/packfile.c b/packfile.c
index 3ecfba66af..5fa7d27d3b 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1333,8 +1333,8 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,
 	hashmap_add(&delta_base_cache, ent);
 }
 
-int packed_object_info(struct packed_git *p, off_t obj_offset,
-		       struct object_info *oi)
+int packed_object_info_the_repository(struct packed_git *p, off_t obj_offset,
+				      struct object_info *oi)
 {
 	struct pack_window *w_curs = NULL;
 	unsigned long size;
diff --git a/packfile.h b/packfile.h
index a92c0b241c..bc8d840b1b 100644
--- a/packfile.h
+++ b/packfile.h
@@ -125,7 +125,8 @@ extern void release_pack_memory(size_t);
 /* global flag to enable extra checks when accessing packed objects */
 extern int do_check_packed_object_crc;
 
-extern int packed_object_info(struct packed_git *pack, off_t offset, struct object_info *);
+#define packed_object_info(r, p, o, oi) packed_object_info_##r(p, o, oi)
+extern int packed_object_info_the_repository(struct packed_git *pack, off_t offset, struct object_info *);
 
 extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
 extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
diff --git a/sha1_file.c b/sha1_file.c
index 93f25c6c6a..b292e04fd3 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1307,7 +1307,8 @@ int oid_object_info_extended_the_repository(const struct object_id *oid, struct
 		 * information below, so return early.
 		 */
 		return 0;
-	rtype = packed_object_info(e.p, e.offset, oi);
+
+	rtype = packed_object_info(the_repository, e.p, e.offset, oi);
 	if (rtype < 0) {
 		mark_bad_packed_object(e.p, real->hash);
 		return oid_object_info_extended(the_repository, real, oi, 0);
-- 
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 ` [PATCH 3/9] packfile: add repository argument to retry_bad_packed_offset Stefan Beller
2018-04-23 23:43 ` [PATCH 4/9] packfile: add repository argument to packed_to_object_type Stefan Beller
2018-04-23 23:43 ` Stefan Beller [this message]
2018-04-24 18:16   ` [PATCH 5/9] packfile: add repository argument to packed_object_info 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-6-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).