git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH v2 3/3] Add 'update-branch' hook

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 23, 2014, 21:22 UTC
Message-ID
<xmqq8uqvyc53.fsf@gitster.dls.corp.google.com>
In-Reply-To
<53582bb6ceb64_24448772ecaf@nysa.notmuch>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 23 quoted lines
> Junio C Hamano wrote:
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>> 
>> > This hook is invoked before 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 three parameters; the name of the branch, the
>> > SHA-1 of the latest commit, and the SHA-1 of the first commit of the
>> > branch.
>> >
>> > When a branch is created the first and last commits of the branch are
>> > the same, however when a branch is rebased they are not. If the SHA-1 of
>> > the first commit of the branch is not available (e.g. git reset) a null
>> > SHA-1 (40 zeroes) would be passed.
>> >
>> > The hook exit status can be used to deny the branch update.
>> >
>> > It can be used to verify the validity of branch names, and also to keep
>> > track of the origin point of a branch, which is otherwise not possible
>> > to find out [1].
>> 
>> Please call it pre-update-branch at least,
>
> I will do so when I see a good argument for it.

If you choose to ignore "a user cannot tell from the name update-branch when it will be called, we cannot introduce post-update-branch later without making things more inconsistent if we do not name it pre-something" and label them not "a good argument", then I do not have anything to say to you.

Previous: Felipe ContrerasNext: Felipe Contreras
Message 11 of 12 in “New 'update-branch' hook”
  1. 0/3 New 'update-branch' hookFelipe Contreras, Apr 23, 2014
  2. 1/3 sh-setup: export GIT_DIRFelipe Contreras, Apr 23, 2014
  3. Jeff KingApr 23, 2014
  4. Junio C HamanoApr 23, 2014
  5. 2/3 run-command: make sure hooks have always GIT_DIRFelipe Contreras, Apr 23, 2014
  6. Junio C HamanoApr 23, 2014
  7. Felipe ContrerasApr 23, 2014
  8. 3/3 Add 'update-branch' hookFelipe Contreras, Apr 23, 2014
  9. Junio C HamanoApr 23, 2014
  10. Felipe ContrerasApr 23, 2014
  11. Junio C HamanoApr 23, 2014
  12. Felipe ContrerasApr 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.