Add a repository argument to allow the callers of istream_source
to be more specific about which repository to act on. 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 <[email protected]>
Signed-off-by: Stefan Beller <[email protected]>
---
 streaming.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/streaming.c b/streaming.c
index 90acf7448f..5d2c24798e 100644
--- a/streaming.c
+++ b/streaming.c
@@ -111,7 +111,8 @@ ssize_t read_istream(struct git_istream *st, void *buf, 
size_t sz)
        return st->vtbl->read(st, buf, sz);
 }
 
-static enum input_source istream_source(const unsigned char *sha1,
+#define istream_source(r, s, t, o) istream_source_##r(s, t, o)
+static enum input_source istream_source_the_repository(const unsigned char 
*sha1,
                                        enum object_type *type,
                                        struct object_info *oi)
 {
@@ -144,7 +145,7 @@ struct git_istream *open_istream_the_repository(const 
unsigned char *sha1,
        struct git_istream *st;
        struct object_info oi = OBJECT_INFO_INIT;
        const unsigned char *real = lookup_replace_object(the_repository, sha1);
-       enum input_source src = istream_source(real, type, &oi);
+       enum input_source src = istream_source(the_repository, real, type, &oi);
 
        if (src < 0)
                return NULL;
-- 
2.15.1.433.g936d1b9894.dirty

Reply via email to