[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: build-aux/git-hooks/pre-push
From: |
Po Lu |
Subject: |
Re: build-aux/git-hooks/pre-push |
Date: |
Mon, 01 May 2023 14:33:27 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Po Lu <luangruo@yahoo.com> writes:
> This script apparently loses when pushing from a separate worktree,
> where .git is a file containing the name of the repository the worktree
> was created from.
>
> The following adjustment seems to fix it. However, I don't know much
> about git. Objections?
>
> diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push
> index 8e8277cba4f..8a2866f9d4c 100755
> --- a/build-aux/git-hooks/pre-push
> +++ b/build-aux/git-hooks/pre-push
> @@ -83,4 +83,4 @@ $awk -v origin_name="$1" '
> # Print every SHA after oldref, up to (and including) newref.
> system("git rev-list --first-parent --reverse " oldref ".." newref)
> }
> -' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk
> +' | $awk -v reason=pre-push -f build-aux/git-hooks/commit-msg-files.awk
Btw, I notice that the script falls back to awk if gawk cannot be found.
Maybe in that case, the awk script should be rewritten to not utilize
getline, sub, function, and other features which do not work with Unix
awk? Or maybe it should try harder to find a POSIX awk?
Thanks.