filter-branch: skip index read/write when possible
[gitweb.git] / builtin / commit-tree.c
index 987a4c3d731d7cf01f61e4fddec208b4cb51a4af..8747c0f2fbe6426b97571bd29df0892efd1fa810 100644 (file)
@@ -10,7 +10,7 @@
 #include "utf8.h"
 #include "gpg-interface.h"
 
-static const char commit_tree_usage[] = "git commit-tree [(-p <sha1>)...] [-S[<keyid>]] [-m <message>] [-F <file>] <sha1> <changelog";
+static const char commit_tree_usage[] = "git commit-tree [(-p <sha1>)...] [-S[<keyid>]] [-m <message>] [-F <file>] <sha1>";
 
 static const char *sign_commit;
 
@@ -66,10 +66,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
                        continue;
                }
 
-               if (!memcmp(arg, "-S", 2)) {
-                       sign_commit = arg + 2;
+               if (skip_prefix(arg, "-S", &sign_commit))
                        continue;
-               }
 
                if (!strcmp(arg, "--no-gpg-sign")) {
                        sign_commit = NULL;
@@ -123,8 +121,8 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
                        die_errno("git commit-tree: failed to read");
        }
 
-       if (commit_tree(&buffer, tree_sha1, parents, commit_sha1,
-                       NULL, sign_commit)) {
+       if (commit_tree(buffer.buf, buffer.len, tree_sha1, parents,
+                       commit_sha1, NULL, sign_commit)) {
                strbuf_release(&buffer);
                return 1;
        }