git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: git@vger.kernel.org, Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH] remote-curl: pass on atomic capability to remote side
Date: Tue, 15 Oct 2019 12:40:29 -0400	[thread overview]
Message-ID: <20191015164028.GA4710@sigill.intra.peff.net> (raw)
In-Reply-To: <20191015010759.2259-1-sandals@crustytoothpaste.net>

On Tue, Oct 15, 2019 at 01:07:59AM +0000, brian m. carlson wrote:

> Fix this by passing the option from the transport code through to remote
> helpers, and from the HTTP remote helper down to send-pack.  With this
> change, we can detect if the server side rejects the push and report
> back appropriately.  Note the difference in the messages: the remote
> side reports "atomic transaction failed", while our own checking rejects
> pushes with the message "atomic push failed".

Good find. The patch looks good to me, except for one minor style nit in
the documentation (see below).

> Document the atomic option in the remote helper documentation, so other
> implementers can implement it if they like.

I wondered what would happen for existing helpers that do not implement
the option, but the behavior here:

> +	if (flags & TRANSPORT_PUSH_ATOMIC)
> +		if (set_helper_option(transport, TRANS_OPT_ATOMIC, "true") != 0)
> +			die(_("helper %s does not support --atomic"), name);
> +

looks like the right thing.

> As I mentioned in the commit message, to my knowledge, this
> functionality has been broken since the atomic capability was introduced
> circa 2.4.0.

Yeah, I tried this with v2.4.0 and it had the same problem (plus it's
very clear from your patch that it's not a regression, but just that
nobody bothered to implement it in the first place).

> diff --git a/Documentation/gitremote-helpers.txt b/Documentation/gitremote-helpers.txt
> index a5c3c04371..670d72c174 100644
> --- a/Documentation/gitremote-helpers.txt
> +++ b/Documentation/gitremote-helpers.txt
> @@ -509,6 +509,11 @@ set by Git if the remote helper has the 'option' capability.
>  	Indicate that only the objects wanted need to be fetched, not
>  	their dependents.
>  
> +'option atomic' {'true'|'false'}::
> +  When pushing, request the remote server to update refs in a single atomic
> +  transaction.  If successful, all refs will be updated, or none will.  If the
> +  remote side does not support this capability, the push will fail.
> +

This is implemented with a single space, but the rest of the option
bodies are indented with a tab. Asciidoc seems to format it identically
either way, though.

-Peff

  reply	other threads:[~2019-10-15 16:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  1:07 [PATCH] remote-curl: pass on atomic capability to remote side brian m. carlson
2019-10-15 16:40 ` Jeff King [this message]
2019-10-16 23:43   ` brian m. carlson
2019-10-17  7:05     ` Junio C Hamano
2019-10-16 23:45 ` [PATCH v2] " brian m. carlson

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015164028.GA4710@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).