From: Junio C Hamano <gitster@pobox.com>
To: Francesco Mazzoli <f@mazzo.li>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] push: add config option to --force-with-lease by default.
Date: Tue, 04 Jul 2017 10:51:49 -0700 [thread overview]
Message-ID: <xmqqvan8jdje.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <1499116727-757-1-git-send-email-f@mazzo.li> (Francesco Mazzoli's message of "Mon, 3 Jul 2017 23:18:47 +0200")
Francesco Mazzoli <f@mazzo.li> writes:
> The flag can be overridden with `--no-force-with-lease`, or by
> passing the config via the command line.
>
> Signed-off-by: Francesco Mazzoli <f@mazzo.li>
> ---
> Documentation/config.txt | 5 +++++
> builtin/push.c | 3 +++
> cache.h | 1 +
> config.c | 4 ++++
> environment.c | 1 +
> 5 files changed, 14 insertions(+)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index 06898a7..36fe882 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -2537,6 +2537,11 @@ push.default::
> specific workflows; for instance, in a purely central workflow
> (i.e. the fetch source is equal to the push destination),
> `upstream` is probably what you want. Possible values are:
> +
> +push.alwaysforcewithlease::
> + When true, `--force-with-lease` is the default behavior when
> + using `push --force`. Explicit invocations of `--force-with-lease`
> + or `--no-force-with-lease` if present, take precedence.
> +
> --
I suspect this may be going in a wrong direction.
People have been burned by the lazy "--force-with-lease" that does
not say what object to expect there and forces the command to DWIM
incorrectly what the remote's ref ought to be pointing at. This
change encourages its use without the user being painfully aware of
that danger. Whenever you say "push --force", you'd be using the
dangerous "--force-with-lease" that does not specify what the
expected current state of the remote is. The end result gives an
illusion of being safer than a simple "--force", without being
not really safer.
I'd understand more if there were two new (and orthogonal) options,
though:
- disable the use of "--force" option, telling the user to use
"--force-with-lease=<object>" instead.
- disable the DWIM based on the remote-tracking branches when
"--force-with-lease[=<refname>]" is used, i.e. error out when the
option is used without a specific object to expect.
next prev parent reply other threads:[~2017-07-04 17:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 21:18 [PATCH] push: add config option to --force-with-lease by default Francesco Mazzoli
2017-07-03 21:47 ` Ævar Arnfjörð Bjarmason
2017-07-03 21:57 ` Francesco Mazzoli
2017-07-03 22:08 ` Francesco Mazzoli
2017-07-03 22:15 ` Ævar Arnfjörð Bjarmason
2017-07-03 22:28 ` Ævar Arnfjörð Bjarmason
2017-07-04 17:51 ` Junio C Hamano [this message]
2017-07-05 6:34 ` Francesco Mazzoli
2017-07-05 7:43 ` Junio C Hamano
2017-07-05 8:04 ` Francesco Mazzoli
2017-07-05 15:17 ` Junio C Hamano
2017-07-05 16:43 ` Francesco Mazzoli
2017-07-05 18:51 ` Mike Rappazzo
2017-07-06 19:13 ` Junio C Hamano
2017-07-07 6:19 ` Francesco Mazzoli
2017-07-05 11:26 ` Ævar Arnfjörð Bjarmason
2017-07-05 15:48 ` Ævar Arnfjörð Bjarmason
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=xmqqvan8jdje.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=f@mazzo.li \
--cc=git@vger.kernel.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 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.