Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes: > ... > The hook is run manually, rather than via run_hook_le(), since it needs > to change the working directory to that of the worktree, and > run_hook_le() does not provide such functionality. As this is a one-off > case, adding 'run_hook' overloads which allow the directory to be set > does not seem warranted at this time. > > Reported-by: Lars Schneider <larsxschneider@xxxxxxxxx> > Signed-off-by: Eric Sunshine <sunshine@xxxxxxxxxxxxxx> > --- > > This is a re-roll of [1] which fixes "git worktree add" to provide > proper context to the 'post-checkout' hook so that the hook knows the > location of the newly-created worktree. > > Changes since v2: > > * Fix crash due to missing NULL-terminator on 'env' list passed to > run_command(). Thanks. This matches what I had (v2 plus manual fixup while queueing) and looks good. As long as the "hand-rolled" implementation uses the same find_hook() helper used in run_hook[lv]e, I do not think a one-off invocation of the hook is not too bad, at least for now.