git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Owen Taylor <otaylor@redhat.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Colin Walters <walters@verbum.org>
Subject: Re: git push --confirm ?
Date: Sat, 12 Sep 2009 16:11:06 -0400	[thread overview]
Message-ID: <1252786266.2974.61.camel@localhost.localdomain> (raw)
In-Reply-To: <20090912184342.GB20561@coredump.intra.peff.net>

On Sat, 2009-09-12 at 14:43 -0400, Jeff King wrote:
> On Sat, Sep 12, 2009 at 01:51:37PM -0400, Owen Taylor wrote:
> 
> >  * An initial --dry-run pass is done but with more verbosity -
> >    for updates of existing references, it would show what commits
> >    were being added or removed in a one-line format.
> > 
> >  * The user is prompted if they want to proceed
> >  
> >  * If the user agrees, then the push is run without --dry-run
> >
> > [...]
> >
> > I think this wouldn't be too hard to add to 'git push', though
> > I haven't tried to code it. Yes, it's not atomic without protocol
> > changes - I think that's OK:
> 
> I have never wanted such a feature, so maybe I am a bad person to
> comment, but I don't see much advantage from a UI standpoint over what
> we have now. Which is "git push --dry-run", check to see if you like it,
> and then re-run without --dry-run. If you just want to see more output
> in the first --dry-run, then that is easy to do with an alternate
> format.

The main UI advantage is that you can adjust the default with 'git
config' it on and leave it on. The time you screw up is not when you are
worried that you are going to push the wrong thing. It's when you are
you know exactly what 'git push' is going to do and it does something
different.

Secondarily, I don't really find the output of 'git push --dry-run'
that great - it's pretty good for finding out what branches you are
going to push... that you correctly understood the syntax of git push
and the relationship to your branch configuration, but not so good at
seeing what's going to be pushed,

If it shows:

 72b3142..1fa3134 my-topic -> my-topic
 12a31aa..34f2621 master -> master

That doesn't necessarily warn you that along with the bug fix you think
you are pushing you have a big merge into master sitting there that you
haven't finished testing. For updates, showing a commit count and (a
probably limited number of) commit subjects would avoid having to
cut-and-paste the update summary into git log.

As you say, maybe that's something that just needs to be fixed
with a better format for --dry-run. But that doesn't negate the main UI
advantage.

> But what _would_ be useful is doing it atomically. You can certainly do
> all three of those steps from within one "git push" invocation, and I
> think that is enough without any protocol changes. The protocol already
> sends for each ref a line like:
> 
>   <old-sha1> <new-sha1> <ref>
> 
> and receive-pack will not proceed with the update unless the <old-sha1>
> matches what is about to be changed.

Hmm, yeah, I've certainly looked at git-receive-pack(1) before but
hadn't internalized that --force was client side. Certainly doing it
with a single atomic pass is the better way to do it.

(Wouldn't work for rsync and http pushes, right? A simple "Not
supported" perhaps.)

> >  - If the push isn't being forced intermediate ref updates will
> >    be caught as a non-fast-forward in the second pass.
> > 
> >  - If the push is being forced, you might overwrite someone else's
> >    push anyways even without --confirm.
> 
> Yeah, "--force" is not very fine-grained. I wonder if rather than a
> complete --confirm you would rather have something iterative like:
> 
>   $ git push --interactive
>   Pushing to server:/path/to/repo.git
>     * [new branch]      topic -> topic
>   Push this branch [Yn]?
>       5ad9dce..cfc497a  topic -> topic
>   Push this branch [Yn]?

Hmm, of two minds about this. Doing it as a pick-and-choose
--interactive does integrate it conceptually with other parts of Git.
And probably is occasionally useful.

But it makes it considerably less convenient to just config on.
Because any time you want to push more than 2-3 refs at once you'll have
to add --no-interactive.

It also increases the amount of reading - if I see all the branches at
once that are being pushed I can immediately notice that I'm pushing two
branches when I thought I was pushing one, without actually having to
read the branch names.

My conception of the feature is as a safety harness. That some people
will be willing to pay a keystroke or two for that double check that
their mental model matches reality.

      5ad9dce...cfc497a topic -> topic (non-fast forward) 
> Force this branch [yN]?

This one is a disaster waiting to happen. Even with the reversed
defaults you may well have the 'y<return>' habit going. Unless the
non-fast-forward looks completely different (Red and Blinky) you
probably are going to go right past it.

- Owen

  reply	other threads:[~2009-09-12 20:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 17:51 git push --confirm ? Owen Taylor
2009-09-12 18:43 ` Jeff King
2009-09-12 20:11   ` Owen Taylor [this message]
2009-09-12 20:49     ` Jeff King
2009-09-12 21:55       ` Daniel Barkalow
2009-09-13  0:41   ` Junio C Hamano
2009-09-13  9:33     ` Jeff King
2009-09-13 10:37       ` Junio C Hamano
2009-09-13 10:52         ` Jeff King
2009-09-13 16:59           ` Uri Okrent

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=1252786266.2974.61.camel@localhost.localdomain \
    --to=otaylor@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=walters@verbum.org \
    /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).