From: "Josh England" <jjengla@sandia.gov>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] post-checkout hook, and related docs and tests
Date: Mon, 24 Sep 2007 16:05:58 -0600 [thread overview]
Message-ID: <1190671558.6078.87.camel@beauty> (raw)
In-Reply-To: <7vejgnai1z.fsf@gitster.siamese.dyndns.org>
On Mon, 2007-09-24 at 14:07 -0700, Junio C Hamano wrote:
> "Josh England" <jjengla@sandia.gov> writes:
>
> > ... Granted, the
> > branch (and HEAD) does not change for this operation, but that shouldn't
> > matter. It is somewhat in line with the principle of 'least-surprise':
> > if the hook runs for 'git checkout otherbranch', but not 'git checkout
> > otherbranch path.c', this could cause confusion and distress to the
> > user. IMO, it is a 'checkout' so the post-checkout hook should run.
> > Why is that so insane?
>
> Because I find it would be surprising if the following commands
> behave differently:
>
> $ git cat-file blob otherbranch:path.c >path.c
> $ git show otherbranch:path.c >path.c
> $ git diff -R otherbranch path.c | git apply
> $ git checkout otherbranch path.c
For all intents and purposes, these would still behave the same. The
existence of a post-checkout hook does not at all affect the outcome of
the checkout. Sure there is potential for someone to do something
stupid inside the hook script, but that is true of any hook.
Most git users would never even enable the hook, but for those that do I
would assume that they'd want the hook to run for all 'git-checkout'
variants -- as I do.
> These are all talking about various ways to _edit_ working tree
> files, and not about switching between revisions.
>
> That's why I said I found that what the second sentence from
> your original description implied ("the hook gets old and new
> commit object name" which means we are talking about switching
> between revisions) was sensible, but it needs to be stressed a
> bit.
>
> If you want to spacial case
>
> $ git checkout otherbranch path.c
>
> it raises another issue. Which commit should supply the
> "extended attribute description" for path.c? Should it be taken
> from the current commit (aka HEAD), otherbranch, or the index?
This already is a special case and your question is valid but not one
that git should necessary care about. Since extended attributes are not
built into git the only way to handle them is through hooks. A such, it
is up to the hook to worry about these kinds of issues. The hook I have
written handles this by updating path.c attributes to match whatever
exists in the (tracked) attributes file of the current HEAD.
This 'git-checkout otherbranch path.c' is a corner case, but one that
can result in broken behavior when handling metadata unless the hook
runs. I just want to close all the holes. I can change the description
of the hook to try to dispel any confusion if that would help.
-JE
next prev parent reply other threads:[~2007-09-24 22:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-21 20:27 [PATCH] post-checkout hook, and related docs and tests root
2007-09-21 20:35 ` Josh England
2007-09-22 0:15 ` Junio C Hamano
2007-09-24 17:14 ` Josh England
2007-09-24 18:34 ` Junio C Hamano
2007-09-24 19:33 ` Josh England
2007-09-24 21:07 ` Junio C Hamano
2007-09-24 22:05 ` Josh England [this message]
2007-09-24 23:54 ` Junio C Hamano
2007-09-25 4:42 ` Andreas Ericsson
2007-09-25 16:41 ` Josh England
2007-09-25 21:29 ` Junio C Hamano
2007-09-25 21:47 ` Josh England
2007-09-26 14:52 ` Dmitry Potapov
2007-09-26 19:23 ` Josh England
2007-09-24 17:58 ` Josh England
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=1190671558.6078.87.camel@beauty \
--to=jjengla@sandia.gov \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox