From 3e230fa1b2ba3aa1a207c4399a1b93e41b103dfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 7 May 2009 21:46:48 +0200 Subject: [PATCH] grep: use parseopt Convert git-grep to parseopt. The bitfields in struct grep_opt are converted to full ints, increasing its size. This shouldn't be a problem as there is only a single instance in memory. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-grep.c | 406 ++++++++++++++++++++++--------------------------- grep.h | 28 ++-- 2 files changed, 194 insertions(+), 240 deletions(-) diff --git a/builtin-grep.c b/builtin-grep.c index 620399f9a..169a91c17 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -10,6 +10,7 @@ #include "tag.h" #include "tree-walk.h" #include "builtin.h" +#include "parse-options.h" #include "grep.h" #ifndef NO_EXTERNAL_GREP @@ -20,6 +21,11 @@ #endif #endif +static char const * const grep_usage[] = { + "git grep [options] [-e] [...] [[--] path...]", + NULL +}; + static int grep_config(const char *var, const char *value, void *cb) { struct grep_opt *opt = cb; @@ -559,15 +565,86 @@ static int grep_object(struct grep_opt *opt, const char **paths, die("unable to grep from object of type %s", typename(obj->type)); } -static const char builtin_grep_usage[] = -"git grep