]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/grep.c
grep: use grep_opt->repo instead of explict repo argument
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 12 Jan 2019 02:13:22 +0000 (09:13 +0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2019 20:13:04 +0000 (12:13 -0800)
commitdba093ddc0341a85f576bbd5227d393a820d930a
treee057a919fefb3a13555d8f2623595dc507566b85
parentecbdaf0899161c067986e9d9d564586d4b045d62
grep: use grep_opt->repo instead of explict repo argument

This command is probably the first one that operates on a repository
other than the_repository, in f9ee2fcdfa (grep: recurse in-process
using 'struct repository' - 2017-08-02). An explicit 'struct
repository *' was added in that commit to pass around the repository
that we're supposed to grep from.

Since 38bbc2ea39 (grep.c: remove implicit dependency on the_index -
2018-09-21). 'struct grep_opt *' carries in itself a repository
parameter for grepping. We should now be able to reuse grep_opt to
hold the submodule repo instead of a separate argument, which is just
room for mistakes.

While at there, use the right reference instead of the_repository and
the_index in this code. I was a bit careless in my attempt to kick
the_repository / the_index out of library code. It's normally safe to
just stick the_repository / the_index in bultin/ code, but it's not
the case for grep.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c