From: Owen Taylor <otaylor@redhat.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Daniel Barkalow <barkalow@iabervon.org>, git@vger.kernel.org
Subject: Re: Patches for git-push --confirm and --show-subjects
Date: Mon, 14 Sep 2009 22:38:49 -0400 [thread overview]
Message-ID: <1252982329.11581.111.camel@localhost.localdomain> (raw)
In-Reply-To: <7v7hw19gr5.fsf@alter.siamese.dyndns.org>
On Mon, 2009-09-14 at 17:46 -0700, Junio C Hamano wrote:
> Owen Taylor <otaylor@redhat.com> writes:
>
> > If I can figure out the rest of it, I'll look at adding a hook on top as
> > a sweetener :-)
>
> Please don't.
>
> I seriously suggest you start from, and stick to, nothing but a hook.
>
> The pre-push codepath is conceptually very simple --- something needs to
> inspect a list of <ref, old, new> and say yes or no. But what the users
> want needs great customizability (e.g. Daniel's sign-off validation
> example). It's the prime example of codepath that should have a hook and
> no built-in policy logic.
Let me back up on this a little bit.
Is confirmation a general need?
In the context of the kernel or git personal repository workflows,
probably not. If you push something wrong, and discover it quickly, you
can just push over it and nobody is wiser. But a large fraction of the
projects listed on the front page of git-scm.com are using shared
repositories. And with a shared repository, a messed up push is more of
an issue: there may be notifications sent out over email or IRC, the
repository may be configured with denyFastForward true, people may
quickly pull your accidental push, etc.
It's also a sticky point for first using git. The push syntax and
behavior is a bit cryptic until you are used to it. Is it going to push
all branches or just the one I'm on? Is 'git push --tags' a superset of
'git push'? etc. If the first repository you are pushing to is public
and shared, heavy use of --dry-run at first is certainly advisable. But
repeating with --dry-run and without is pretty awkward.
How would the quality of use be as a hook?
Probably good enough. The broad outlines are achievable anyways. There
are some aspects of my patches that wouldn't be there. A few that come
to mind:
- The --show-subjects option applied to all displays of push
references, not just for --confirm.
- In the case of a successful push when the updates are exactly what
was confirmed, outputting them again after the push is suppressed.
How would ease of configuration be for a hook?
> E.g. perhaps in $HOME/.gitconfig, you may want to allow
>
> [hook]
> prePush = $HOME/.githooks/my-pre-push-hook
> preCommit = $HOME/.githooks/my-pre-commit-hook
This is certainly better than having to set it up per-repo, but if I
wanted to tell GNOME contributors how to turn it on, I'd have to provide
a gnome-contributor-git-setup.sh. Even if the hooks were shipped with
git, there's not going to be a cross-distro path to the where they are
installed.
Maybe if a there was a "hook path" that included ~/.githooks and a
system directory? Though:
git-config --global hook.prePush git-pre-push-confirm
could still overwrite something that they already have configured; it
wouldn't be an "orthogonal tip" that you could find on a web page and
apply blindly.
Providing a gnome-contributor-git-setup.sh is generally an approach of
last resort. I don't think there is anything unique or special about how
we do we do git on gnome.org that makes it different from other
shared-repository workflows. I'd like the knowledge that people get
using Git with GNOME to carry over to other work they do with Git and
vice-versa.
- Owen
next prev parent reply other threads:[~2009-09-15 2:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-13 23:31 Patches for git-push --confirm and --show-subjects Owen Taylor
2009-09-13 23:31 ` [PATCH 1/4] push: add --confirm option to ask before sending updates Owen Taylor
2009-09-13 23:31 ` [PATCH 2/4] push: allow configuring default for --confirm Owen Taylor
2009-09-13 23:31 ` [PATCH 3/4] push: add --show-subjects option to show commit synopsis Owen Taylor
2009-09-13 23:31 ` [PATCH 4/4] push: allow configuring default for --show-subjects Owen Taylor
2009-09-14 0:47 ` Patches for git-push --confirm and --show-subjects Junio C Hamano
2009-09-14 0:53 ` Junio C Hamano
2009-09-14 2:35 ` Owen Taylor
2009-09-14 22:21 ` Daniel Barkalow
2009-09-14 23:18 ` Owen Taylor
2009-09-15 0:46 ` Junio C Hamano
2009-09-15 2:38 ` Owen Taylor [this message]
2009-09-15 5:50 ` Junio C Hamano
2009-09-15 11:50 ` Owen Taylor
2009-09-15 0:55 ` Daniel Barkalow
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=1252982329.11581.111.camel@localhost.localdomain \
--to=otaylor@redhat.com \
--cc=barkalow@iabervon.org \
--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;
as well as URLs for NNTP newsgroup(s).