git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] grep: use grep_opt->repo instead of explict repo argument

From
Stefan Beller <sbeller@google.com>
Date
Nov 26, 2018, 19:52 UTC
Message-ID
<CAGZ79kZHFxahZMAZh2Ldscfqp0OWAae7dowAboLDac-UmTHwYw@mail.gmail.com>
In-Reply-To
<20181118163851.32178-1-pclouds@gmail.com>
On Sun, Nov 18, 2018 at 8:38 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
Show 12 quoted lines
>
> 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.

That makes sense. Assuming we did not make a mistake yet, the test suite would not need changes (further assuming we do test for it, but we do as we have explicit submodule grep tests).

Show 6 quoted lines
>
> 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>
Previous: Nguyễn Thái Ngọc Duy
Message 2 of 2 in “grep: use grep_opt->repo instead of explict repo argument”
  1. grep: use grep_opt->repo instead of explict repo argumentNguyễn Thái Ngọc Duy, Nov 18, 2018
  2. Stefan BellerNov 26, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.