From: Felipe Contreras <felipe.contreras@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Ilya Bobyr <ilya.bobyr@gmail.com>
Subject: Re: [RFC/PATCH v2 3/3] Add 'update-branch' hook
Date: Wed, 23 Apr 2014 16:08:06 -0500 [thread overview]
Message-ID: <53582bb6ceb64_24448772ecaf@nysa.notmuch> (raw)
In-Reply-To: <xmqqsip3yemg.fsf@gitster.dls.corp.google.com>
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.
> unless you want to make sure that time spent on others in the discussion
> thread for the previous round becomes wasted.
Unless you want to make sure the time *I* spent in the discussion is wasted.
I'm still waiting for replies to my last arguments.
> > +update-branch
> > +~~~~~~~~~~~~~
> > +
> > +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'.
>
> Does "git checkout -B aBranch" count?
Yes.
> Does "git reset $there" count?
Yes.
> I guess "git commit" or "git merge" on a branch to advance its tip
> in a usual way would not count (and I can think of good reasons why
> they should not count), but it is only a weak "guess". The above
> two lines does not give readers enough hint to determine if "branch
> and rebase will be the only two and no other command will ever
> trigger" or "branch and rebase are only examples---for others, guess
> on your own" (and if the latter, enough clue to use in guessing).
> I cannot guess if "git fetch $there $that:refs/heads/master" should
> trigger the hook, for example.
>
> To put it another way.
>
> How does one, who is adding a new command that causes a branch tip
> to be updated, to decide if it should trigger this hook? What are
> the common things among commands that can update branch tips that
> this hook gets called that are missing from commands that update
> branch tips that this hook does not get called?
I guess the guideline should be: if the branch is clearly moving forward the
hook is not called, if the branch is manually changed in any way, it should.
This omits non-porcelain commands, such as update-ref. I don't think those
should trigger the hook.
--
Felipe Contreras
next prev parent reply other threads:[~2014-04-23 21:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 19:42 [RFC/PATCH v2 0/3] New 'update-branch' hook Felipe Contreras
2014-04-23 19:42 ` [RFC/PATCH v2 1/3] sh-setup: export GIT_DIR Felipe Contreras
2014-04-23 20:01 ` Jeff King
2014-04-23 20:18 ` Junio C Hamano
2014-04-23 19:42 ` [RFC/PATCH v2 2/3] run-command: make sure hooks have always GIT_DIR Felipe Contreras
2014-04-23 20:37 ` Junio C Hamano
2014-04-23 21:15 ` Felipe Contreras
2014-04-23 19:42 ` [RFC/PATCH v2 3/3] Add 'update-branch' hook Felipe Contreras
2014-04-23 20:28 ` Junio C Hamano
2014-04-23 21:08 ` Felipe Contreras [this message]
2014-04-23 21:22 ` Junio C Hamano
2014-04-23 21:35 ` Felipe Contreras
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=53582bb6ceb64_24448772ecaf@nysa.notmuch \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ilya.bobyr@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.