From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: bmwill@google.com, jonathantanmy@google.com,
sandals@crustytoothpaste.net, Stefan Beller <sbeller@google.com>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: [PATCHv2 4/9] packfile: add repository argument to packed_to_object_type
Date: Tue, 24 Apr 2018 14:59:04 -0700 [thread overview]
Message-ID: <20180424215910.22201-5-sbeller@google.com> (raw)
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
next prev parent reply other threads:[~2018-04-24 21:59 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 21:59 [PATCHv2 0/9] object store: oid_object_info is the next contender Stefan Beller
2018-04-24 21:59 ` [PATCHv2 1/9] cache.h: add repository argument to oid_object_info_extended Stefan Beller
2018-04-24 21:59 ` [PATCHv2 2/9] cache.h: add repository argument to oid_object_info Stefan Beller
2018-04-24 21:59 ` [PATCHv2 3/9] packfile: add repository argument to retry_bad_packed_offset Stefan Beller
2018-04-24 21:59 ` Stefan Beller [this message]
2018-04-24 21:59 ` [PATCHv2 5/9] packfile: add repository argument to packed_object_info Stefan Beller
2018-04-24 21:59 ` [PATCHv2 6/9] packfile: add repository argument to read_object Stefan Beller
2018-04-24 21:59 ` [PATCHv2 7/9] packfile: add repository argument to unpack_entry Stefan Beller
2018-04-24 21:59 ` [PATCHv2 8/9] packfile: add repository argument to cache_or_unpack_entry Stefan Beller
2018-04-24 21:59 ` [PATCHv2 9/9] cache.h: allow oid_object_info to handle arbitrary repositories Stefan Beller
2018-04-24 22:49 ` Jonathan Tan
2018-04-24 21:59 ` [PATCHv2 9/9] cache.h: allow sha1_object_info " Stefan Beller
2018-04-25 18:20 ` [PATCHv3 0/9] object store: oid_object_info is the next contender Stefan Beller
2018-04-25 18:20 ` [PATCHv3 1/9] cache.h: add repository argument to oid_object_info_extended Stefan Beller
2018-04-25 18:20 ` [PATCHv3 2/9] cache.h: add repository argument to oid_object_info Stefan Beller
2018-04-25 18:21 ` [PATCHv3 3/9] packfile: add repository argument to retry_bad_packed_offset Stefan Beller
2018-04-25 18:21 ` [PATCHv3 4/9] packfile: add repository argument to packed_to_object_type Stefan Beller
2018-04-25 18:21 ` [PATCHv3 5/9] packfile: add repository argument to packed_object_info Stefan Beller
2018-04-25 18:21 ` [PATCHv3 6/9] packfile: add repository argument to read_object Stefan Beller
2018-04-25 18:21 ` [PATCHv3 7/9] packfile: add repository argument to unpack_entry Stefan Beller
2018-04-25 18:21 ` [PATCHv3 8/9] packfile: add repository argument to cache_or_unpack_entry Stefan Beller
2018-04-25 18:21 ` [PATCHv3 9/9] cache.h: allow oid_object_info to handle arbitrary repositories Stefan Beller
2018-04-25 20:37 ` [PATCHv3 0/9] object store: oid_object_info is the next contender Jonathan Tan
2018-04-26 16:30 ` Brandon Williams
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180424215910.22201-5-sbeller@google.com \
--to=sbeller@google.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=jrnieder@gmail.com \
--cc=sandals@crustytoothpaste.net \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.