all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
Subject: Re: build-aux/git-hooks/pre-push
Date: Mon, 1 May 2023 09:55:08 -0700	[thread overview]
Message-ID: <e0e2ce4c-9a9b-7d8e-3d6f-90f9f8000397@gmail.com> (raw)
In-Reply-To: <875y9cef96.fsf@yahoo.com>

On 4/30/2023 11:29 PM, Po Lu wrote:
> 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.

Thanks for catching this bug.

> 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
> 
> 

That won't quite work in general, since it would mean that if you check 
out an old branch, "build-aux/git-hooks/commit-msg-files.awk" won't 
exist, and then the hook will fail. Instead, I pushed a change to 
replace ".git" with "${GIT_DIR:-.git}", which is (as far as I can tell) 
the right way to do this.

(The fallback to ".git" in the expansion is purely defensive, just in 
case there's some old Git version that doesn't set that variable.)



  parent reply	other threads:[~2023-05-01 16:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <875y9cef96.fsf.ref@yahoo.com>
2023-05-01  6:29 ` build-aux/git-hooks/pre-push Po Lu
2023-05-01  6:33   ` build-aux/git-hooks/pre-push Po Lu
2023-05-02  5:35     ` build-aux/git-hooks/pre-push Jim Porter
2023-05-02  5:55       ` build-aux/git-hooks/pre-push Po Lu
2023-05-01 16:55   ` Jim Porter [this message]
2023-05-02  0:08     ` build-aux/git-hooks/pre-push Po Lu
2023-05-04 10:37     ` build-aux/git-hooks/pre-push Basil Contovounesios
2023-05-04 16:28       ` build-aux/git-hooks/pre-push Jim Porter
2023-05-04 16:42         ` build-aux/git-hooks/pre-push Basil Contovounesios
2023-05-04 16:56           ` build-aux/git-hooks/pre-push Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0e2ce4c-9a9b-7d8e-3d6f-90f9f8000397@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.