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

Re: [PATCH] grep: remove "repo" arg from non-supporting funcs

From
Stefan Beller <sbeller@google.com>
Date
Mar 27, 2018, 23:20 UTC
Message-ID
<CAGZ79kY-E5FZRJAg6QG0DX1TzWXgo9LqJ-b7JojpkD6_BdF-wQ@mail.gmail.com>
In-Reply-To
<20180327225850.166523-1-jonathantanmy@google.com>
On Tue, Mar 27, 2018 at 3:58 PM, Jonathan Tan <jonathantanmy@google.com> wrote:
Show 15 quoted lines
> As part of commit f9ee2fcdfa ("grep: recurse in-process using 'struct
> repository'", 2017-08-02), many functions in builtin/grep.c were
> converted to also take "struct repository *" arguments. Among them were
> grep_object() and grep_objects().
>
> However, at least grep_objects() was converted incompletely - it calls
> gitmodules_config_oid(), which references the_repository.
>
> But it turns out that the conversion was extraneous anyway - there has
> been no user-visible effect - because grep_objects() is never invoked
> except with the_repository.
>
> Revert the changes to grep_objects() and grep_object() (which conversion
> is also extraneous) to show that both these functions do not support
> repositories other than the_repository.

I'd rather convert gitmodules_config_oid instead of reverting the other functions into a world without an arbitrary repository object.

Show 10 quoted lines
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> Patch 1/5 of your series is obviously correct.
>
> I investigated the change to grep_objects() in patch 2/5, and here is a
> patch summarizing my findings. Consider including this patch before 2/5
> (or before 1/5). You'll probably need to write
> "submodule_free(the_repository);" instead of what you have currently,
> but other than that, I don't think this affects your patch set much.

Thanks for looking at the patches! I'd think this patch is orthogonal to the series, as this is about the effort of converting parts of git-grep whereas this series is fixing a bug (by converting parts of the submodule config machinery))?

Thanks, Stefan

Previous: Jonathan TanNext: Jonathan Tan
Message 9 of 36 in “Moving submodules with nested submodules”
  1. 0/5 Moving submodules with nested submodulesStefan Beller, Mar 27, 2018
  2. 1/5 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 27, 2018
  3. 3/5 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 27, 2018
  4. Jonathan TanMar 27, 2018
  5. Stefan BellerMar 27, 2018
  6. 2/5 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 27, 2018
  7. Brandon WilliamsMar 27, 2018
  8. grep: remove "repo" arg from non-supporting funcsJonathan Tan, Mar 27, 2018
  9. Stefan BellerMar 27, 2018
  10. Jonathan TanMar 28, 2018
  11. Stefan BellerMar 28, 2018
  12. 5/5 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 27, 2018
  13. Brandon WilliamsMar 27, 2018
  14. Jonathan TanMar 28, 2018
  15. Stefan BellerMar 28, 2018
  16. 0/6 Moving submodules with nested submodulesStefan Beller, Mar 28, 2018
  17. 1/6 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 28, 2018
  18. 2/6 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 28, 2018
  19. 4/6 submodule-config: remove submodule_from_cacheStefan Beller, Mar 28, 2018
  20. 5/6 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 28, 2018
  21. Brandon WilliamsMar 28, 2018
  22. Stefan BellerMar 28, 2018
  23. Jonathan TanMar 28, 2018
  24. 3/6 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 28, 2018
  25. 6/6 grep: remove "repo" arg from non-supporting funcsStefan Beller, Mar 28, 2018
  26. Jonathan TanMar 28, 2018
  27. 0/6 Moving submodules with nested submodulesStefan Beller, Mar 28, 2018
  28. 1/6 submodule.h: drop declaration of connect_work_tree_and_git_dirStefan Beller, Mar 28, 2018
  29. 2/6 grep: remove "repo" arg from non-supporting funcsStefan Beller, Mar 28, 2018
  30. 3/6 submodule-config: allow submodule_free to handle arbitrary repositoriesStefan Beller, Mar 28, 2018
  31. 6/6 submodule: fixup nested submodules after moving the submoduleStefan Beller, Mar 28, 2018
  32. 4/6 submodule-config: add repository argument to submodule_from_{name, path}Stefan Beller, Mar 28, 2018
  33. 5/6 submodule-config: remove submodule_from_cacheStefan Beller, Mar 28, 2018
  34. Jonathan TanMar 28, 2018
  35. 4/5 submodule-config: remove submodule_from_cacheStefan Beller, Mar 27, 2018
  36. Jonathan TanMar 27, 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.