X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=commit-tree.c;h=25958509703f7e46dc0b1a4bffd7be8ba2897cf9;hb=7ebdba614223f867d3f19963647406df1d0e5ce0;hp=2d8651894a20e752eb47e6da439ad3cee13c29c4;hpb=12d81ce59846e17676c5534257ca2f1783829d63;p=git.git diff --git a/commit-tree.c b/commit-tree.c index 2d865189..25958509 100644 --- a/commit-tree.c +++ b/commit-tree.c @@ -45,14 +45,13 @@ static void add_buffer(char **bufp, unsigned int *sizep, const char *fmt, ...) static void check_valid(unsigned char *sha1, const char *expect) { - void *buf; char type[20]; - unsigned long size; - buf = read_sha1_file(sha1, type, &size); - if (!buf || strcmp(type, expect)) - die("%s is not a valid '%s' object", sha1_to_hex(sha1), expect); - free(buf); + if (sha1_object_info(sha1, type, NULL)) + die("%s is not a valid object", sha1_to_hex(sha1)); + if (expect && strcmp(type, expect)) + die("%s is not a valid '%s' object", sha1_to_hex(sha1), + expect); } /*