Skip to content

Commit bf93eea

Browse files
chriscoolgitster
authored andcommitted
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>
1 parent 500a04f commit bf93eea

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cache.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,12 @@ static inline const unsigned char *lookup_replace_object(const unsigned char *sh
773773
return sha1;
774774
return do_lookup_replace_object(sha1);
775775
}
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+
}
776782

777783
/* Read and unpack a sha1 file into memory, write memory to a sha1 file */
778784
extern int sha1_object_info(const unsigned char *, unsigned long *);

sha1_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,8 +2662,7 @@ void *read_sha1_file_extended(const unsigned char *sha1,
26622662
void *data;
26632663
char *path;
26642664
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);
26672666

26682667
errno = 0;
26692668
data = read_object(repl, type, size);

0 commit comments

Comments
 (0)