Re: [PATCH 1/2] commit.c - provide commit-type to the hooks/pre-commit script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]