summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-07-14 15:35:31 +0700
committerJunio C Hamano <gitster@pobox.com>2013-07-15 10:56:06 -0700
commit0fdc2ae5125b61e5cfe0cd49b064d8367994e61b (patch)
tree5b3b209423f7d5f19ca501ae5befe705547d2415 /builtin/grep.c
parentfc12261fea778cabd08dec707169cb88ecdbc647 (diff)
downloadgit-0fdc2ae5125b61e5cfe0cd49b064d8367994e61b.tar.gz
convert some get_pathspec() calls to parse_pathspec()
These call sites follow the pattern: paths = get_pathspec(prefix, argv); init_pathspec(&pathspec, paths); which can be converted into a single parse_pathspec() call. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 4de49df917..1a6c02804c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -631,7 +631,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
const char *show_in_pager = NULL, *default_pager = "dummy";
struct grep_opt opt;
struct object_array list = OBJECT_ARRAY_INIT;
- const char **paths = NULL;
struct pathspec pathspec;
struct string_list path_list = STRING_LIST_INIT_NODUP;
int i;
@@ -858,8 +857,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
verify_filename(prefix, argv[j], j == i);
}
- paths = get_pathspec(prefix, argv + i);
- init_pathspec(&pathspec, paths);
+ parse_pathspec(&pathspec, 0,
+ PATHSPEC_PREFER_CWD,
+ prefix, argv + i);
pathspec.max_depth = opt.max_depth;
pathspec.recursive = 1;