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

Re: [GSoC][PATCH] grep: fix worktree case in submodules

From
Matheus Tavares Bernardino <matheus.bernardino@usp.br>
Date
Aug 1, 2019, 03:08 UTC
Message-ID
<CAHd-oW78PpLspY94F9JDfw3C6v3oRbt0tZY1Jth4R_WbYUSQCg@mail.gmail.com>
In-Reply-To
<xmqqwofyqjrz.fsf@gitster-ct.c.googlers.com>
On Wed, Jul 31, 2019 at 12:57 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
>
> Christian Couder <christian.couder@gmail.com> writes:
>
> > On Tue, Jul 30, 2019 at 10:04 PM Junio C Hamano <gitster@pobox.com> wrote:
> >>
> >> Matheus Tavares <matheus.bernardino@usp.br> writes:
> >
> >> > @@ -598,7 +599,8 @@ static int grep_tree(struct grep_opt *opt, const struct pathspec *pathspec,
> >> >                       free(data);
> >> >               } else if (recurse_submodules && S_ISGITLINK(entry.mode)) {
> >> >                       hit |= grep_submodule(opt, pathspec, &entry.oid,
> >> > -                                           base->buf, base->buf + tn_len);
> >> > +                                           base->buf, base->buf + tn_len,
> >> > +                                           1); /* ignored */
> >>
> >> The trailing comment is misleading.  In the context of reviewing
> >> this patch, we can probably tell it applies only to that "1", but
> >> if you read only the postimage, the "ignored" comment looks as if
> >> the call itself is somehow ignored by somebody unspecified.  It is
> >> not clear at all that it is only about the final parameter.
> >>
> >> If you must...
> >>
> >>                 hit |= grep_submodule(opt, pathspec, &entry.oid,
> >>                                       base->buf, base->buf + tn_len,
> >>                                       1 /* ignored */);
> >
> > Yeah, I suggested adding an "/* ignored */" comment, but I was indeed
> > thinking about something like this.
> >
> >> ... is a reasonable way to write it.
>
> Thanks.  In this case, I am not sure if the comment here really
> helps.  If anything, shouldn't there be a comment near the top of
> grep_submodule() that says 'cached bit is meaningful only when you
> feed an empty oid, aka "not grepping inside a tree object"'?
Right, it makes sense. I'll add that.
Previous: Junio C HamanoNext: Matheus Tavares Bernardino
Message 10 of 14 in “Weird behavior with git grep --recurse-submodules”
  1. Daniel ZaouiJul 8, 2019
  2. Matheus Tavares BernardinoJul 10, 2019
  3. Johannes SchindelinJul 10, 2019
  4. Daniel ZaouiJul 16, 2019
  5. Matheus Tavares BernardinoJul 29, 2019
  6. [GSoC][PATCH] grep: fix worktree case in submodulesMatheus Tavares, Jul 30, 2019
  7. Junio C HamanoJul 30, 2019
  8. Christian CouderJul 30, 2019
  9. Junio C HamanoJul 31, 2019
  10. Matheus Tavares BernardinoAug 1, 2019
  11. Matheus Tavares BernardinoJul 30, 2019
  12. [GSoC][PATCH v2] grep: fix worktree case in submodulesMatheus Tavares, Jul 31, 2019
  13. [GSoC][PATCH v3] grep: fix worktree case in submodulesMatheus Tavares, Aug 1, 2019
  14. Brandon WilliamsAug 3, 2019

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.