sha1_file.c: add lookup_replace_object_extended() to pass flags
Currently, there is only one caller to lookup_replace_object() that can benefit from passing it some flags, but we expect that there could be more. 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
bf93eea0f67082ec295ac60fa78986f339adf2c6
2 files changed
+7
-2
cache.h
+6
@@ -773,6 +773,12 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh
773
return sha1;
774
return do_lookup_replace_object(sha1);
775
}
776
+static inline const unsigned char *lookup_replace_object_extended(const unsigned char *sha1, unsigned flag)
777
+{
778
+ if (!(flag & LOOKUP_REPLACE_OBJECT))
779
+ return sha1;
780
+ return lookup_replace_object(sha1);
781
+}
782
783
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
784
extern int sha1_object_info(const unsigned char *, unsigned long *);
sha1_file.c
+1
-2
@@ -2662,8 +2662,7 @@ void *read_sha1_file_extended(const unsigned char *sha1,
2662
void *data;
2663
char *path;
2664
const struct packed_git *p;
2665
- const unsigned char *repl = (flag & LOOKUP_REPLACE_OBJECT)
2666
- ? lookup_replace_object(sha1) : sha1;
2665
+ const unsigned char *repl = lookup_replace_object_extended(sha1, flag);
2666
2667
errno = 0;
2668
data = read_object(repl, type, size);