X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-cat-file.c;h=590684200854ad6a71653f30d494eb191fd4a324;hb=ec82874ad47627a44b6b22a6645551a214293711;hp=3fba6b9e743545868368a0e554466fca3814316a;hpb=a1eb73d917e15cd97314e0a39cbe857329339a96;p=git.git diff --git a/builtin-cat-file.c b/builtin-cat-file.c index 3fba6b9e7..590684200 100644 --- a/builtin-cat-file.c +++ b/builtin-cat-file.c @@ -137,7 +137,7 @@ 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", exp_type); } if (!buf) @@ -189,9 +189,8 @@ static int batch_one_object(const char *obj_name, int print_contents) static int batch_objects(int print_contents) { - struct strbuf buf; + struct strbuf buf = STRBUF_INIT; - strbuf_init(&buf, 0); while (strbuf_getline(&buf, stdin, '\n') != EOF) { int error = batch_one_object(buf.buf, print_contents); if (error) @@ -202,8 +201,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 }; @@ -232,7 +231,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix) if (argc != 3 && argc != 2) usage_with_options(cat_file_usage, options); - argc = parse_options(argc, argv, options, cat_file_usage, 0); + argc = parse_options(argc, argv, prefix, options, cat_file_usage, 0); if (opt) { if (argc == 1)