git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Jeff King <peff@peff.net>
Cc: Mark Levedahl <mlevedahl@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] commit.c - provide commit-type to the hooks/pre-commit script
Date: Mon, 07 Jun 2010 08:26:53 +0200	[thread overview]
Message-ID: <4C0C912D.9080404@viscovery.net> (raw)
In-Reply-To: <20100606221037.GE6993@coredump.intra.peff.net>

Am 6/7/2010 0:10, schrieb Jeff King:
> On Sat, Jun 05, 2010 at 01:39:50PM -0400, Mark Levedahl wrote:
> 
>> -	if (!no_verify && run_hook(index_file, "pre-commit", NULL))
>> +	if (!no_verify && run_hook(index_file, "pre-commit", amend ? "amend" : "normal", NULL))
>> [...]
>> -	against=HEAD
>> +	if test "$1" = "amend"
>> +	then
>> +		against=HEAD~1
>> +	else
>> +		against=HEAD
>> +	fi
> 
> Is there a reason to use the magic "amend" and "normal" words, if
> scripts are just going to end up changing them back into HEAD~1 and HEAD
> anyway?

pre-commit might act differently when a commit is amended, the most likely
reason I can think of is to always allow to amend. When you have only a
SHA1, you can get that information only with an additional process.

-- Hannes

  parent reply	other threads:[~2010-06-07  6:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-05 17:39 [PATCH 1/2] commit.c - provide commit-type to the hooks/pre-commit script Mark Levedahl
2010-06-05 17:43 ` [PATCH 2/2] git-gui " Mark Levedahl
2010-06-06 22:10 ` [PATCH 1/2] commit.c " Jeff King
2010-06-07  0:21   ` Mark Levedahl
2010-06-07  6:26   ` Johannes Sixt [this message]
2010-06-07  6:38     ` Jeff King
2010-06-08  2:55       ` Mark Levedahl

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=4C0C912D.9080404@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=mlevedahl@gmail.com \
    --cc=peff@peff.net \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).