From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.devel Subject: Re: build-aux/git-hooks/pre-push Date: Mon, 1 May 2023 09:55:08 -0700 Message-ID: References: <875y9cef96.fsf.ref@yahoo.com> <875y9cef96.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3623"; mail-complaints-to="usenet@ciao.gmane.io" To: Po Lu , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 01 18:56:07 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptWoo-0000kL-To for ged-emacs-devel@m.gmane-mx.org; Mon, 01 May 2023 18:56:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptWo0-0006KZ-Gu; Mon, 01 May 2023 12:55:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptWnz-0006KR-6m for emacs-devel@gnu.org; Mon, 01 May 2023 12:55:15 -0400 Original-Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptWnx-0005AD-AF for emacs-devel@gnu.org; Mon, 01 May 2023 12:55:14 -0400 Original-Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1aad55244b7so17650375ad.2 for ; Mon, 01 May 2023 09:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682960108; x=1685552108; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=DtvTepOP6+DN6VcBVVUA5GbQ0s+APoZkradyPW8eXSk=; b=bK2NFvK1yG3XQZHoVMgdriszg7zoOLJkGnVmGXASEyI7BXgnKc6oIV8CtJUYDqKcIh O648Bz8NNMzuPJMPO7l9BLTKUP4VTGLdVoOg5KQrfFJ/ZB1IuWAm1wGIBJIJw+De7Sw+ ujfs1qtJAqsuZM2A9QOAb2VU13qKkTncMNHZ3dX3u1GpzJjxJoP74xwy6R5dmy2kr17S drgd9xdHCemuITsoQ9Aj8wzDBH3PDHmOOoUbtQPaY1WKqmZMVKwMYS5XP64Z30uMtG1K jaSsjXQDT0E3z5NlPI/aoLmSQVHqF+ZPQpgbs0ClBEBpeV28jMVPwt2ngKdJcHLAA+XJ aJig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682960108; x=1685552108; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DtvTepOP6+DN6VcBVVUA5GbQ0s+APoZkradyPW8eXSk=; b=GkGZDCUcjiMCv910NKZVtjIM4zRP6nQg8/2Amw21ClePPrRjyjSoNtDwX4oMWHuBxH RGcKtOemsn+LbQa7FlbnU+9RJqiYBpmpRj4WNGhsD5r0K8yj1/c5l2zngx1bixQaeAGm VfZ+sC3WZb9YLt7yUC73RUepmVc9TxkwzA/qhbtrdQNTDreBqI+8hnqdA7O1SwkUy7R0 MVwruHfnlmdlsmlnuugtK+61dSY/85A+w1J4xgLrVbSk+JSHNdT62qQe62i12EX78E/Y RdU1bNoph0amQT8T4RXKfnDRWwK9m3tvkfy+VDJIPq5acbKGhoeI1xwNYsgxd64gjXYe X7Dw== X-Gm-Message-State: AC+VfDw6QEhxZEdvqqdgV1UgxwK59mmZm+2H5rTEbhRstct18zUzXN8e hz1DFVkm/DWjmzwDi/tkiC4= X-Google-Smtp-Source: ACHHUZ6K+mlinpsUdS5bQ/pcJSwmMv3+SemZ0tLC/p0AOwtK1EWF7+HjQnpapQGMubMmn6paa2UxPg== X-Received: by 2002:a17:902:b48e:b0:1a9:a3b3:f935 with SMTP id y14-20020a170902b48e00b001a9a3b3f935mr14392738plr.57.1682960107916; Mon, 01 May 2023 09:55:07 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id 3-20020a170902c20300b001ab05aaae2fsm278854pll.107.2023.05.01.09.55.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 May 2023 09:55:07 -0700 (PDT) Content-Language: en-US In-Reply-To: <875y9cef96.fsf@yahoo.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=jporterbugs@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:305744 Archived-At: 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.)