git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Steffen Prohaska <prohaska@zib.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref
Date: Wed, 31 Oct 2007 01:45:42 -0700	[thread overview]
Message-ID: <7v8x5jiseh.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <F5F68690-68A3-4AFC-A79C-FF02910F0359@zib.de> (Steffen Prohaska's message of "Wed, 31 Oct 2007 08:53:06 +0100")

Steffen Prohaska <prohaska@zib.de> writes:

> Would it be acceptable if the error was less severe in the
> case of local being a strict subset of remote?
> Daniel proposed
> "%s: nothing to push to %s, but you are not up-to-date and
> may want to pull"
> It would still be an error, but a less severe one.

I am not convinced there is one true total order of "error
severity" that applies uniformly across different workflows, so
I would not immediately agree if you are suggesting to introduce
"severity levels".  But it certainly makes a lot of sense to be
able to _differentiate_ kinds of errors, and to have the calling
scripts and the push command itself react to them.

What are the possible error conditions?

 1. Error on the sending side.  The ref parameters given to
    git-push were bogus, or they were good commits but they were
    not fully connected to the commits the other side has
    (i.e. local repository corruption).  pack-objects will abort
    and no remote (nor local tracking ref that tracks what we
    pushed to the remote) would be updated.  This should be
    "most severe" in _any_ workflow, so I do not mind calling
    this "fatal".

 2. Push to a ref does fast forward, but the update hook on the
    remote side declines.  The ref on the remote nor the
    corresponding local tracking ref would not be updated, and
    the command would fail.

For all the other classes of errors, the ref on the remote nor
the corresponding local tracking ref would not be updated, and
by default, an error on any ref causes the command to error out.
For each of these classes of errors, we _could_ have an option
to let you tell the command not to error out because of it.

 3. Push to a ref does not fast forward and --force is not
    given, but you can prove the remote is strict subset of
    local (what your 10/10 wants to do).

 4. Same as #3 but you cannot prove the remote is strict subset
    of local.

Any other classes?

It might be a good idea to generalize 3 & 4, by the way.  The
remote being a strict descendant of what is being pushed might
be something you happened to want today, but somebody else may
come up with a different rule tomorrow.  So, 

 3'. Push to a ref does not fast forward and --force is not
     given, but there is a configuration (would this be per
     remote?, per remote branch?, or per local branch?) that
     tells git-push to call a hook on the local side that takes
     <ref being pushed, ref on the remote> as its parameter.
     The result from the hook does not change the fact that this
     is still an error, but it can instruct git-push not to
     error out due to this condition.

In some other workflows, it might make sense to maybe even
making 2. not to cause the error from git-push.  I dunno.

> It could also be a good idea to teach git push transactional
> behaviour.

That is certainly true.  I am not sure about other transports,
but it should be a relatively straightforward protocol extension
for the git native transport.

> - git push can be configuration to push only the current
>   branch, as outlined below. This would certainly work. What
>   I do not like is that you first need to do some configuration
>   before you get a safe working environment.

I would not doubt it would be safer for _your_ workflow, but you
should consider the risk of making things more cumbersome for
workflows of others by enforcing that policy.

In other words, don't change anything unless you have a very
good reason to convince everybody else that it is universally
a good change to the default.

  reply	other threads:[~2007-10-31  8:46 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-28 17:46 [PATCH 0/10 v3] improve refspec handling in push Steffen Prohaska
2007-10-28 17:46 ` [PATCH 01/10] push: change push to fail if short refname does not exist Steffen Prohaska
2007-10-28 17:46   ` [PATCH 02/10] push: teach push new flag --create Steffen Prohaska
2007-10-28 17:46     ` [PATCH 03/10] push: support pushing HEAD to real branch name Steffen Prohaska
2007-10-28 17:46       ` [PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo' Steffen Prohaska
2007-10-28 17:46         ` [PATCH 05/10] rename ref_matches_abbrev() to ref_abbrev_matches_full_with_fetch_rules() Steffen Prohaska
2007-10-28 17:46           ` [PATCH 06/10] add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref name Steffen Prohaska
2007-10-28 17:46             ` [PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs Steffen Prohaska
2007-10-28 17:46               ` [PATCH 08/10] push: teach push to accept --verbose option Steffen Prohaska
2007-10-28 17:46                 ` [PATCH 09/10] push: teach push to pass --verbose option to transport layer Steffen Prohaska
2007-10-28 17:46                   ` [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref Steffen Prohaska
2007-10-30  8:29                     ` Junio C Hamano
2007-10-30 10:15                       ` Steffen Prohaska
2007-10-30 10:26                         ` Andreas Ericsson
2007-10-30 10:53                           ` Steffen Prohaska
2007-10-30 19:19                         ` Junio C Hamano
2007-10-31  7:53                           ` Steffen Prohaska
2007-10-31  8:45                             ` Junio C Hamano [this message]
     [not found]                               ` <B3C76DB8-076D-4C43-AC28-99119A05325C@z ib.de>
2007-10-31  9:14                               ` Junio C Hamano
2007-10-31 10:50                               ` Steffen Prohaska
2007-10-31 18:51                                 ` Junio C Hamano
2007-10-31 21:09                                   ` Steffen Prohaska
2007-10-31 21:31                                     ` Junio C Hamano
2007-11-01  7:03                                       ` Steffen Prohaska
2007-11-01  9:11                                         ` Andreas Ericsson
2007-11-01 16:43                                           ` Steffen Prohaska
2007-11-01 20:18                                             ` Junio C Hamano
2007-11-02  7:21                                               ` Steffen Prohaska
2007-11-02  7:52                                                 ` Junio C Hamano
2007-11-02 10:03                                                   ` Steffen Prohaska
2007-11-02 10:44                                                     ` Junio C Hamano
2007-11-02 11:40                                                       ` Steffen Prohaska
2007-11-02 10:03                                             ` Andreas Ericsson
2007-11-02 13:24                                               ` Tom Prince
2007-11-02 13:52                                                 ` Andreas Ericsson
2007-11-02 14:49                                                   ` Steffen Prohaska
2007-11-02 19:42                                                   ` Junio C Hamano
2007-11-02 20:19                                                     ` Junio C Hamano
2007-11-01  8:18                                       ` Andreas Ericsson
2007-11-01  8:36                                         ` Steffen Prohaska
2007-11-01  9:29                                           ` Andreas Ericsson
2007-11-02  8:18                                       ` Wincent Colaiuta
2007-11-02 12:14                                         ` Johannes Schindelin
2007-11-02 12:48                                           ` Steffen Prohaska
2007-11-02 13:11                                             ` Wincent Colaiuta
2007-10-30 18:00                       ` Daniel Barkalow
2007-10-30  8:28               ` [PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs Junio C Hamano
2007-10-30  8:49                 ` Steffen Prohaska
2007-10-30  8:28         ` [PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo' Junio C Hamano
2007-10-30  8:28       ` [PATCH 03/10] push: support pushing HEAD to real branch name Junio C Hamano
2007-10-30  8:29   ` [PATCH 01/10] push: change push to fail if short refname does not exist Junio C Hamano
2007-10-30  8:56     ` Steffen Prohaska
2007-10-30  9:22       ` Junio C Hamano

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=7v8x5jiseh.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=prohaska@zib.de \
    /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).