sha1_object_info_extended(): add an "unsigned flags" parameter

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>

Christian Couder committed Dec 11, 2013 at 08:46 UTC de7b5d6218e4b928c5a395e34e5e1de40fae2a0d
4 files changed +6 -6
builtin/cat-file.c
+1 -1
@@ -238,7 +238,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
238 return 0;
239 }
240
241 - if (sha1_object_info_extended(data->sha1, &data->info) < 0) {
241 + if (sha1_object_info_extended(data->sha1, &data->info, LOOKUP_REPLACE_OBJECT) < 0) {
242 printf("%s missing\n", obj_name);
243 fflush(stdout);
244 return 0;
cache.h
+1 -1
@@ -1104,7 +1104,7 @@ struct object_info {
1104 } packed;
1105 } u;
1106 };
1107 -extern int sha1_object_info_extended(const unsigned char *, struct object_info *);
1107 +extern int sha1_object_info_extended(const unsigned char *, struct object_info *, unsigned flags);
1108
1109 /* Dumb servers support */
1110 extern int update_server_info(int);
sha1_file.c
+3 -3
@@ -2514,7 +2514,7 @@ static int sha1_loose_object_info(const unsigned char *sha1,
2514 return 0;
2515 }
2516
2517 -int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
2517 +int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi, unsigned flags)
2518 {
2519 struct cached_object *co;
2520 struct pack_entry e;
@@ -2548,7 +2548,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi)
2548 rtype = packed_object_info(e.p, e.offset, oi);
2549 if (rtype < 0) {
2550 mark_bad_packed_object(e.p, sha1);
2551 - return sha1_object_info_extended(sha1, oi);
2551 + return sha1_object_info_extended(sha1, oi, 0);
2552 } else if (in_delta_base_cache(e.p, e.offset)) {
2553 oi->whence = OI_DBCACHED;
2554 } else {
@@ -2570,7 +2570,7 @@ int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
2570
2571 oi.typep = &type;
2572 oi.sizep = sizep;
2573 - if (sha1_object_info_extended(sha1, &oi) < 0)
2573 + if (sha1_object_info_extended(sha1, &oi, LOOKUP_REPLACE_OBJECT) < 0)
2574 return -1;
2575 return type;
2576 }
streaming.c
+1 -1
@@ -113,7 +113,7 @@ static enum input_source istream_source(const unsigned char *sha1,
113
114 oi->typep = type;
115 oi->sizep = &size;
116 - status = sha1_object_info_extended(sha1, oi);
116 + status = sha1_object_info_extended(sha1, oi, 0);
117 if (status < 0)
118 return stream_error;
119