Re: [PATCH v2 1/2] Documentation/githooks: mention pwd, $GIT_PREFIX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Hansen <rhansen@xxxxxxx> writes:

> Document that hooks are run from the top-level directory and that
> GIT_PREFIX is set to the name of the original subdirectory (relative
> to the top-level directory).
>
> Signed-off-by: Richard Hansen <rhansen@xxxxxxx>
> ---
>  Documentation/githooks.txt | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
> index 9ef2469..c08f4fd 100644
> --- a/Documentation/githooks.txt
> +++ b/Documentation/githooks.txt
> @@ -26,6 +26,12 @@ executable by default.
>  
>  This document describes the currently defined hooks.
>  
> +Hooks are executed from the top-level directory of a repository, which
> +may not necessarily be the current directory.

I agree that it is a good idea to describe how the hook writers can
go to the top-level directory and how the hook writers can discover
where the hooked operation started, but these two lines cannot be
the whole story---what happens when there is no top-level directory
(i.e. a bare repository)?

Is this universal to all hooks, or just the ones you examined?  I
ask this because I know we do not go through a single interface to
call out to hooks that says "cd to the root and then run the hook
given as an argument".

> +The 'GIT_PREFIX' environment variable is set as returned by running
> +'git rev-parse --show-prefix' from the original current directory.

Is this also universal, or is it set only for some but not all
hooks?  What happens in a bare repository?  What is given if you are
in a non-bare repository and are already at the root level?

> +See linkgit:git-rev-parse[1].
> +
>  HOOKS
>  -----
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]