Subject: Re: [RTC/PATCH] Add 'update-branch' hook

From: Ilya Bobyr <[email-masked]>
Date: Mon, 21 Apr 2014 23:41:44 -0700

On 4/21/2014 1:49 PM, Felipe Contreras wrote:
> Ilya Bobyr wrote:
>> On 4/20/2014 7:23 PM, Felipe Contreras wrote:
>>> This hook is invoked whenever a branch is updated, either when a branch
>>> is created or updated with 'git branch', or when it's rebased with 'git
>>> rebase'. It receives two parameters; the name of the branch, and the
>>> SHA-1 of the latest commit, additionally, if there was a base commit the
>>> branch was rebased onto, a third parameter contains it.
>> And the old branch SHA could be found from in the reflog, correct?
> Actually the old branch SHA-1 is actually the current one, since the branch
> hasn't been updated at that point. Personally I don't see much value in adding
> something the script can easily find out.

If the hook is about a branch update, I would expect it to provide both
old and new points for the branch, along with the name.

The fact that for rebases it also provides new base SHA is very
convenient.  As it is an optional argument it may make further extension
of the interface a bit awkward.
So, is seems reasonable to provide both from the very beginning.
I was looking for hooks like that, to maintain certain meta-data about
the branches.
Old SHA would be very useful in that case.

I am not sure if both SHAs are easily available at the point where the
hook is called.