X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sha1_file.c;h=357f9ab7ff6aad644857986f36fd55da8348744f;hb=2c9078d05bf2200c9671e0b292638d42e7e4fd71;hp=1a7e41070efa6327859d3c09ede07317cc91ba7d;hpb=f574cb3404a87d99604c9fc77efb95fe362f0b72;p=git.git diff --git a/sha1_file.c b/sha1_file.c index 1a7e41070..357f9ab7f 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2205,23 +2205,21 @@ static void *read_object(const unsigned char *sha1, enum object_type *type, * deal with them should arrange to call read_object() and give error * messages themselves. */ -void *read_sha1_file_repl(const unsigned char *sha1, - enum object_type *type, - unsigned long *size, - const unsigned char **replacement) +void *read_sha1_file_extended(const unsigned char *sha1, + enum object_type *type, + unsigned long *size, + unsigned flag) { - const unsigned char *repl = lookup_replace_object(sha1); void *data; char *path; const struct packed_git *p; + const unsigned char *repl = (flag & READ_SHA1_FILE_REPLACE) + ? lookup_replace_object(sha1) : sha1; errno = 0; data = read_object(repl, type, size); - if (data) { - if (replacement) - *replacement = repl; + if (data) return data; - } if (errno && errno != ENOENT) die_errno("failed to read object %s", sha1_to_hex(sha1));