git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Andrea Wyss <andrea.wyss@gmail.com>, git@vger.kernel.org
Subject: Re: amend param not available to the pre-commit hook
Date: Sun, 2 Aug 2020 16:10:53 +0100
Message-ID: <f9016e7a-0769-6a55-ab32-6b54674ae2c1@gmail.com> (raw)
In-Reply-To: <30DFCBF3-FEA8-4FF5-94ED-A81AB10B04A3@gmail.com>

Hi Andrea

On 02/08/2020 14:22, Andrea Wyss wrote:
> Issue
> amend param not available to the pre-commit hook
> 
> Problem
> Cannot write a pre-commit hook that stops amending a commit that is present in other branches.
> 
> Steps to Reproduce (git version 2.21.1)
> 1. Code in the pre-commit hook:
>    echo "DEBUG 0='$0' 1='$1'"
> 
> 2. run:
>    git commit --amend
> 
> Current Result
>    DEBUG 0='.git/hooks/pre-commit' 1=''
> 
> Expected Result
>    DEBUG 0='.git/hooks/pre-commit' 1='--amend'

I'm not sure why you expect this, the documentation for the pre-commit 
hook states 'this hook takes no parameters'

That does not mean that it would not be useful to have this information 
available to the pre-commit and possibly prepare-commit-msg hooks but it 
is not a bug. I'm not sure that adding a parameter to the hook is a good 
route as it may break existing hooks that do not expect any parameters, 
maybe we could pass it in the environment.

Best Wishes

Phillip

> Please, let me know if you need other info.
> I'm looking forward for a fix or workaround.
> 
> Thank you,
> Andrea Wyss
> 

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 13:22 Andrea Wyss
2020-08-02 15:10 ` Phillip Wood [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=f9016e7a-0769-6a55-ab32-6b54674ae2c1@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=andrea.wyss@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /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

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git