all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Basil Contovounesios <contovob@tcd.ie>
Cc: Po Lu <luangruo@yahoo.com>, emacs-devel@gnu.org
Subject: Re: build-aux/git-hooks/pre-push
Date: Thu, 4 May 2023 09:28:29 -0700	[thread overview]
Message-ID: <67ee197b-f0d2-d27d-d1c9-5d2302035c37@gmail.com> (raw)
In-Reply-To: <87ttwspekw.fsf@tcd.ie>

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

On 5/4/2023 3:37 AM, Basil Contovounesios wrote:
> So maybe we should be defensive about the existence of this hook?
> Or am I doing something wrong?

I guess that's what I get for just trusting the Git manual instead of 
verifying that my fix worked. How about this?

[-- Attachment #2: 0001-Fix-post-commit-and-pre-push-hooks-in-worktrees-agai.patch --]
[-- Type: text/plain, Size: 1755 bytes --]

From d3ec68f5e433e5792c1c63672c7b437bb29c5759 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Thu, 4 May 2023 09:22:40 -0700
Subject: [PATCH] ; Fix post-commit and pre-push hooks in worktrees again

* build-aux/git-hooks/post-commit:
* build-aux/git-hooks/pre-push: Use "$(dirname $0)" to get the hooks
directory.
---
 build-aux/git-hooks/post-commit | 4 +++-
 build-aux/git-hooks/pre-push    | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/build-aux/git-hooks/post-commit b/build-aux/git-hooks/post-commit
index 05f2d778b5c..10f43b539ac 100755
--- a/build-aux/git-hooks/post-commit
+++ b/build-aux/git-hooks/post-commit
@@ -34,6 +34,8 @@
 
 ### Code:
 
+HOOKS_DIR=$(dirname $0)
+
 # Prefer gawk if available, as it handles NUL bytes properly.
 if type gawk >/dev/null 2>&1; then
   awk="gawk"
@@ -42,4 +44,4 @@ else
 fi
 
 git rev-parse HEAD | $awk -v reason=post-commit \
-                          -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk
+                          -f $HOOKS_DIR/commit-msg-files.awk
diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push
index 6ff59102fd7..8d5dde2bbaf 100755
--- a/build-aux/git-hooks/pre-push
+++ b/build-aux/git-hooks/pre-push
@@ -31,6 +31,8 @@
 
 ### Code:
 
+HOOKS_DIR=$(dirname $0)
+
 # Prefer gawk if available, as it handles NUL bytes properly.
 if type gawk >/dev/null 2>&1; then
   awk="gawk"
@@ -83,4 +85,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_DIR:-.git}/hooks/commit-msg-files.awk
+' | $awk -v reason=pre-push -f $HOOKS_DIR/commit-msg-files.awk
-- 
2.25.1


  reply	other threads:[~2023-05-04 16:28 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   ` build-aux/git-hooks/pre-push Jim Porter
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       ` Jim Porter [this message]
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=67ee197b-f0d2-d27d-d1c9-5d2302035c37@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=contovob@tcd.ie \
    --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.