X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-cat-file.c;h=3fba6b9e743545868368a0e554466fca3814316a;hb=bf474e2402e51843e8230c064da6ccfdf3a8ff54;hp=f8b3160668e1eeff3ef9a893459c64992aa53b5b;hpb=e919cb302e75141c2565106bed2f0b6cb8047570;p=git.git diff --git a/builtin-cat-file.c b/builtin-cat-file.c index f8b316066..3fba6b9e7 100644 --- a/builtin-cat-file.c +++ b/builtin-cat-file.c @@ -137,11 +137,11 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) break; default: - die("git-cat-file: unknown option: %s\n", exp_type); + die("git cat-file: unknown option: %s\n", exp_type); } if (!buf) - die("git-cat-file %s: bad file", obj_name); + die("git cat-file %s: bad file", obj_name); write_or_die(1, buf, size); return 0; @@ -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; @@ -168,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); @@ -178,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; @@ -198,8 +202,8 @@ static int batch_objects(int print_contents) } static const char * const cat_file_usage[] = { - "git-cat-file [-t|-s|-e|-p|] ", - "git-cat-file [--batch|--batch-check] < ", + "git cat-file [-t|-s|-e|-p|] ", + "git cat-file [--batch|--batch-check] < ", NULL };