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

Re: [PATCH 1/2] run-command: teach 'run_hook' about alternate worktrees

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 12, 2018, 21:49 UTC
Message-ID
<CAPig+cSbtATV8daCsDxXTfGPgGh-qrvoVzfBSB+WP3EuiDXNxQ@mail.gmail.com>
In-Reply-To
<42C41062-D27D-4BB8-8D8D-9272D37FAE88@gmail.com>

On Mon, Feb 12, 2018 at 3:58 PM, Lars Schneider <larsxschneider@gmail.com> wrote:

Show 11 quoted lines
>> On 12 Feb 2018, at 04:15, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> +int run_hook_ve(const char *const *env, const char *name, va_list args)
>> +{
>> +     return run_hook_cd_ve(NULL, env, name, args);
>> +}
>
> I think we have only one more user for this function:
>         builtin/commit.c:       ret = run_hook_ve(hook_env.argv,name, args);
>
> Would it be an option to just use the new function signature
> everywhere and remove the wrapper? Or do we value the old interface?

I did note that there was only one existing caller and considered simply modifying run_hook_ve()'s signature to accept the new 'dir' argument. I don't feel strongly one way or the other.

However, as mentioned elsewhere[1], I'm still not convinced that this one-off case of needing to chdir() warrants adding these overloads to 'run-command' at all, so I'm strongly considering (and was considering even for v1) instead just running this hook manually in builtin/worktree.c.

[1]: https://public-inbox.org/git/CAPig+cQ6Tq3J=bS8ymDqiXqUvoUiP59T=FGZgMw2FOAx0vyo=Q@mail.gmail.com/
Previous: Lars SchneiderNext: Eric Sunshine
Message 14 of 24 in “worktree: set worktree environment in post-checkout hook”
  1. worktree: set worktree environment in post-checkout hooklars.schneider@autodesk.com, Feb 10, 2018
  2. Lars SchneiderFeb 10, 2018
  3. 0/2 worktree: change to new worktree dir before running hook(s)Eric Sunshine, Feb 12, 2018
  4. 2/2 worktree: add: change to new worktree directory before running hookEric Sunshine, Feb 12, 2018
  5. Junio C HamanoFeb 12, 2018
  6. Eric SunshineFeb 12, 2018
  7. Lars SchneiderFeb 12, 2018
  8. Eric SunshineFeb 13, 2018
  9. Eric SunshineFeb 13, 2018
  10. Johannes SixtFeb 13, 2018
  11. Eric SunshineFeb 13, 2018
  12. 1/2 run-command: teach 'run_hook' about alternate worktreesEric Sunshine, Feb 12, 2018
  13. Lars SchneiderFeb 12, 2018
  14. Eric SunshineFeb 12, 2018
  15. worktree: add: fix 'post-checkout' not knowing new worktree locationEric Sunshine, Feb 15, 2018
  16. Junio C HamanoFeb 15, 2018
  17. Eric SunshineFeb 15, 2018
  18. Junio C HamanoFeb 15, 2018
  19. Eric SunshineFeb 15, 2018
  20. worktree: add: fix 'post-checkout' not knowing new worktree locationEric Sunshine, Feb 15, 2018
  21. Lars SchneiderFeb 16, 2018
  22. Eric SunshineFeb 16, 2018
  23. Junio C HamanoFeb 16, 2018
  24. Eric SunshineFeb 12, 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.