X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-cat-file.c;h=880e75af5e1951689a417aa47e64f99a20d46ae6;hb=fcf74dbfca9738a724995c92f0845e8018e51a0e;hp=200345e7fbd54d86fb1e4db228244b7a7a221562;hpb=8366b7baae7e5a33f609b07c939a3571653a2314;p=git.git diff --git a/builtin-cat-file.c b/builtin-cat-file.c index 200345e7f..880e75af5 100644 --- a/builtin-cat-file.c +++ b/builtin-cat-file.c @@ -150,7 +150,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) static int batch_one_object(const char *obj_name, int print_contents) { unsigned char sha1[20]; - enum object_type type; + enum object_type type = 0; unsigned long size; void *contents = contents; @@ -159,6 +159,7 @@ static int batch_one_object(const char *obj_name, int print_contents) if (get_sha1(obj_name, sha1)) { printf("%s missing\n", obj_name); + fflush(stdout); return 0; } @@ -167,8 +168,11 @@ static int batch_one_object(const char *obj_name, int print_contents) else type = sha1_object_info(sha1, &size); - if (type <= 0) - return 1; + if (type <= 0) { + printf("%s missing\n", obj_name); + fflush(stdout); + return 0; + } printf("%s %s %lu\n", sha1_to_hex(sha1), typename(type), size); fflush(stdout); @@ -177,6 +181,7 @@ static int batch_one_object(const char *obj_name, int print_contents) write_or_die(1, contents, size); printf("\n"); fflush(stdout); + free(contents); } return 0;