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

Re: [PATCH v2] builtin: allow passing custom data to sub-commands

From
shejialuo <shejialuo@gmail.com>
Date
Nov 26, 2024, 11:57 UTC
Message-ID
<Z0W3rgHQhmUxjgfp@ArchLinux>
In-Reply-To
<20241126-374-add-repository-to-subsubcommands-v2-1-417e0dc66c75@gmail.com>
On Tue, Nov 26, 2024 at 12:19:22PM +0100, Karthik Nayak wrote:
Show 11 quoted lines
> In 9b1cb5070f (builtin: add a repository parameter for builtin
> functions, 2024-09-13) the repository was passed down to all builtin
> commands. This allowed the repository to be passed down to lower layers
> without depending on the global `the_repository` variable.
> 
> To remove usage of global variables like `the_repository` in
> sub-commands, it makes sense to pass down the repository value from the
> commands to the sub-commands. But let's make it more generic and modify
> `parse_opt_subcommand_fn` to instead take a `void *` value. This way we
> can provide custom structures to each sub-command.
> 

From my perspective, I think using either "struct repository *" or "void *" is OK. However, I am a little concerned about using "void *" at current. It gives me a feeling that we over-optimize here.

Thanks, Jialuo

Previous: Karthik NayakNext: karthik nayak
Message 8 of 12 in “builtin: pass repository to sub commands”
  1. builtin: pass repository to sub commandsKarthik Nayak, Nov 25, 2024
  2. Christian CouderNov 26, 2024
  3. karthik nayakNov 26, 2024
  4. Patrick SteinhardtNov 26, 2024
  5. karthik nayakNov 26, 2024
  6. Junio C HamanoNov 26, 2024
  7. builtin: allow passing custom data to sub-commandsKarthik Nayak, Nov 26, 2024
  8. shejialuoNov 26, 2024
  9. karthik nayakNov 26, 2024
  10. Junio C HamanoNov 26, 2024
  11. karthik nayakNov 27, 2024
  12. karthik nayakNov 27, 2024

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.