summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 633e355)
raw | patch | inline | side by side (parent: 633e355)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 May 2009 17:31:56 +0000 (10:31 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 10 May 2009 19:41:35 +0000 (12:41 -0700) |
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-mktree.c | patch | blob | history |
diff --git a/builtin-mktree.c b/builtin-mktree.c
index 3d054272d5f34e310fa619f183e46ee3a91ede75..2b3145bc725bc8c7948cc2229441130b8fe4027c 100644 (file)
--- a/builtin-mktree.c
+++ b/builtin-mktree.c
#include "builtin.h"
#include "quote.h"
#include "tree.h"
+#include "parse-options.h"
static struct treeent {
unsigned mode;
write_sha1_file(buf.buf, buf.len, tree_type, sha1);
}
-static const char mktree_usage[] = "git mktree [-z]";
+static const char *mktree_usage[] = {
+ "git mktree [-z]",
+ NULL
+};
int cmd_mktree(int ac, const char **av, const char *prefix)
{
struct strbuf p_uq = STRBUF_INIT;
unsigned char sha1[20];
int line_termination = '\n';
+ const struct option option[] = {
+ OPT_SET_INT('z', NULL, &line_termination, "input is NUL terminated", '\0'),
+ OPT_END()
+ };
- while ((1 < ac) && av[1][0] == '-') {
- const char *arg = av[1];
- if (!strcmp("-z", arg))
- line_termination = 0;
- else
- usage(mktree_usage);
- ac--;
- av++;
- }
+ ac = parse_options(ac, av, option, mktree_usage, 0);
while (strbuf_getline(&sb, stdin, line_termination) != EOF) {
char *ptr, *ntr;