X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fcommit-tree.c;h=d083795e26e7893c6b7d466f9bcf2be1311cfeb2;hb=aef5c38b59e111892cfb95cfafbef2c11cc69b4b;hp=87f0591c2f68a03e06c73b352282426b803450ba;hpb=bff6e86b3d01febaa2d73ff4e890f091999e9e28;p=git.git diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 87f0591c2..d083795e2 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -9,7 +9,7 @@ #include "builtin.h" #include "utf8.h" -static const char commit_tree_usage[] = "git commit-tree [-p ]* < changelog"; +static const char commit_tree_usage[] = "git commit-tree [(-p )...] < changelog"; static void new_parent(struct commit *parent, struct commit_list **parents_p) { @@ -56,10 +56,12 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix) if (strbuf_read(&buffer, 0, 0) < 0) die_errno("git commit-tree: failed to read"); - if (!commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) { - printf("%s\n", sha1_to_hex(commit_sha1)); - return 0; - } - else + if (commit_tree(buffer.buf, tree_sha1, parents, commit_sha1, NULL)) { + strbuf_release(&buffer); return 1; + } + + printf("%s\n", sha1_to_hex(commit_sha1)); + strbuf_release(&buffer); + return 0; }