Christian Couder <christian.couder@xxxxxxxxx> writes: > On Tue, Jul 30, 2019 at 10:04 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: >> >> Matheus Tavares <matheus.bernardino@xxxxxx> 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"'?