From: Junio C Hamano Date: Thu, 30 Oct 2014 20:04:26 GMT Subject: Re: [PATCH 2/8] send-pack.c: add an --atomic-push command line argument Message-ID: In-Reply-To: <1413924400-15418-3-git-send-email-sahlberg@google.com> Ronnie Sahlberg writes: > diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt > index 2a0de42..8f64feb 100644 > --- a/Documentation/git-send-pack.txt > +++ b/Documentation/git-send-pack.txt > @@ -9,7 +9,7 @@ git-send-pack - Push objects over Git protocol to another repository > SYNOPSIS > -------- > [verse] > -'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=] [--verbose] [--thin] [:] [...] > +'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=] [--verbose] [--thin] [--atomic-push] [:] [...] > > DESCRIPTION > ----------- > @@ -62,6 +62,11 @@ be in a separate packet, and the list must end with a flush packet. > Send a "thin" pack, which records objects in deltified form based > on objects not included in the pack to reduce network traffic. > > +--atomic-push:: > + With atomic-push all refs are updated in one single atomic transaction. > + This means that if any of the refs fails then the entire push will > + fail without changing any refs. Whenever you say "This means that", please read it twice to see if everything before and including that phrase can be removed. It is a sign that you found what you wrote before it is not understandable and what follows is the version that would be understood by the readers. > @@ -203,6 +203,13 @@ static int ref_update_to_be_sent(const struct ref *ref, const struct send_pack_a > case REF_STATUS_REJECT_NEEDS_FORCE: > case REF_STATUS_REJECT_STALE: > case REF_STATUS_REJECT_NODELETE: > + if (atomic_push_failed && args->use_atomic_push) { Hmph. Can we even get atomis_push_failed when args->use_atomic_push is not set? > + fprintf(stderr, "Atomic push is not possible " > + "for ref %s. Status:%d\n", ref->name, > + ref->status); > + *atomic_push_failed = 1; > + } > + /* fallthrough */ Is this "is not possible" (hence we do not let the user use it), or "failed" (i.e. we tried and we failed)?