]> Pileus Git - ~andy/git/commitdiff
sha1_object_info_extended(): add an "unsigned flags" parameter
authorChristian Couder <chriscool@tuxfamily.org>
Wed, 11 Dec 2013 07:46:07 +0000 (08:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Dec 2013 19:53:48 +0000 (11:53 -0800)
This parameter is not used yet, but it will be used to tell
sha1_object_info_extended() if it should perform object
replacement or not.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
cache.h
sha1_file.c
streaming.c

index b2ca775a80f54fcceba344d5545fe3cb34ba0184..b15c0649e9d3b584b5c37d8b1038c4ff61965292 100644 (file)
@@ -238,7 +238,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
                return 0;
        }
 
-       if (sha1_object_info_extended(data->sha1, &data->info) < 0) {
+       if (sha1_object_info_extended(data->sha1, &data->info, LOOKUP_REPLACE_OBJECT) < 0) {
                printf("%s missing\n", obj_name);
                fflush(stdout);
                return 0;
diff --git a/cache.h b/cache.h
index 1086071d5e43c21a6c442ab4683ddba621f02f45..9ba9773edfdeb0ffc543bdb3eb02ea16eee427ef 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1104,7 +1104,7 @@ struct object_info {
                } packed;
        } u;
 };
-extern int sha1_object_info_extended(const unsigned char *, struct object_info *);
+extern int sha1_object_info_extended(const unsigned char *, struct object_info *, unsigned flags);
 
 /* Dumb servers support */
 extern int update_server_info(int);
index b0a39649bf036cbb6c44f8fd132373fba018bd42..46ed1b12c9e6807622299a1f7d12ee620a2b0ec1 100644 (file)
@@ -2514,7 +2514,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
        return 0;
 }
 
-int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
+int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, unsigned flags)
 {
        struct cached_object *co;
        struct pack_entry e;
@@ -2548,7 +2548,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
        rtype = packed_object_info(e.p, e.offset, oi);
        if (rtype < 0) {
                mark_bad_packed_object(e.p, sha1);
-               return sha1_object_info_extended(sha1, oi);
+               return sha1_object_info_extended(sha1, oi, 0);
        } else if (in_delta_base_cache(e.p, e.offset)) {
                oi->whence = OI_DBCACHED;
        } else {
@@ -2570,7 +2570,7 @@ int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
 
        oi.typep = &type;
        oi.sizep = sizep;
-       if (sha1_object_info_extended(sha1, &oi) < 0)
+       if (sha1_object_info_extended(sha1, &oi, LOOKUP_REPLACE_OBJECT) < 0)
                return -1;
        return type;
 }
index debe904523252ae4fd2e18784641575c3f828dd2..9659f18be263a3412a2f3e5d13eb4f4bcd25cee3 100644 (file)
@@ -113,7 +113,7 @@ static enum input_source istream_source(const unsigned char *sha1,
 
        oi->typep = type;
        oi->sizep = &size;
-       status = sha1_object_info_extended(sha1, oi);
+       status = sha1_object_info_extended(sha1, oi, 0);
        if (status < 0)
                return stream_error;