Thread (581 messages) flat view 581 messages, 16 authors, 2021-10-12

RE: [PATCH v3 6/6] hook: allow out-of-repo 'git hook' invocations

From: Randall S. Becker <hidden>
Date: 2021-08-24 20:38:19

On August 24, 2021 4:12 PM, Ævar Arnfjörð Bjarmason wrote:
On Wed, Aug 18 2021, Emily Shaffer wrote:
quoted
Since hooks can now be supplied via the config, and a config can be
present without a gitdir via the global and system configs, we can
start to allow 'git hook run' to occur without a gitdir. This enables
us to do things like run sendemail-validate hooks when running 'git send-email'
from a nongit directory.
Sensible goal. Perhaps we should note in an earlier commit when config-based hooks are introduced something like:
To clarify the requirements here, if running without a gitdir (and thus without a repository?) how will front-ends know what to supply? Will this just be "some shell script" that runs?
   Even though we've added config-based hooks, they currently only work
   if we can find a .git directory, even though certain commands such
   as "git send-email" (or only that command?) can be run outside of a
   git directory. A subsequent commit will address that edge-case.
So we cannot assume anything about the repository, correct? Similar to running git version but not git status?
quoted
[...]
Notes:
    For hookdir hooks, do we want to run them in nongit dir when core.hooksPath
    is set? For example, if someone set core.hooksPath in their global config and
    then ran 'git hook run sendemail-validate' in a nongit dir?
So this is complete consent to run outside of git? I wonder whether there needs to be an attribute associated with the hook that enables this edge capability. That way we can validate whether the hook should be run or not (from front-end scripts).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help