Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-09 Thread Emily Shaffer
Firstly, sorry for the delay, I wasn't working for national holiday from the 4th til yesterday. > If I were tasked with developing this further, I would try to move as much > of the setup into the initial test case (if there is already a `setup` > test case; otherwise I would create one). In fact,

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-04 Thread Johannes Schindelin
Hi Emily, On Wed, 3 Jul 2019, Emily Shaffer wrote: > On Wed, Jul 03, 2019 at 09:41:46PM +0200, Johannes Schindelin wrote: > > > On Wed, 3 Jul 2019, Emily Shaffer wrote: > > > > > > > + up="$HTTPD_URL"/smart/atomic-branches.git && > > > > > + test_commit atomic1 && > > > > > + test_com

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Emily Shaffer
On Wed, Jul 03, 2019 at 09:41:46PM +0200, Johannes Schindelin wrote: > Hi Emily, > > On Wed, 3 Jul 2019, Emily Shaffer wrote: > > > > > + up="$HTTPD_URL"/smart/atomic-branches.git && > > > > + test_commit atomic1 && > > > > + test_commit atomic2 && > > > > + git push "$up"

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Johannes Schindelin
Hi Emily, On Wed, 3 Jul 2019, Emily Shaffer wrote: > > > + up="$HTTPD_URL"/smart/atomic-branches.git && > > > + test_commit atomic1 && > > > + test_commit atomic2 && > > > + git push "$up" master && > > > > It would be more succinct to do a `git clone --bare . "$d"` here, instead > > of a `git in

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Emily Shaffer
> > > > +' > > > + > > > +test_expect_success 'push --atomic shows all failed refs' ' > > > + # Make up/master, up/allrefs > > > + d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-failed-refs.git && > > > + git init --bare "$d" && > > > + git --git-dir="$d" config http.receivepack true && > > > + up="$HTTPD_URL"

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Emily Shaffer
On Wed, Jul 03, 2019 at 11:13:45AM -0700, Junio C Hamano wrote: > SZEDER Gábor writes: > > > On Tue, Jul 02, 2019 at 02:37:42PM -0700, Junio C Hamano wrote: > >> > +test_expect_success 'push --atomic shows all failed refs' ' > >> > +# Make up/master, up/allrefs > >> > +d=$HTTPD_DO

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Emily Shaffer
> > +test_expect_success 'push --atomic also prevents branch creation' ' > > + # Make up/master > > + d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git && > > + git init --bare "$d" && > > + git --git-dir="$d" config http.receivepack true && > > Why not `-C "$d"`? The example I had found bel

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread Junio C Hamano
SZEDER Gábor writes: > On Tue, Jul 02, 2019 at 02:37:42PM -0700, Junio C Hamano wrote: >> > +test_expect_success 'push --atomic shows all failed refs' ' >> > + # Make up/master, up/allrefs >> > + d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-failed-refs.git && >> > + git init --bare "$d" && >> > + git -

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-03 Thread SZEDER Gábor
On Tue, Jul 02, 2019 at 02:37:42PM -0700, Junio C Hamano wrote: > > +test_expect_success 'push --atomic shows all failed refs' ' > > + # Make up/master, up/allrefs > > + d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-failed-refs.git && > > + git init --bare "$d" && > > + git --git-dir="$d" config http.

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Emily Shaffer
On Tue, Jul 02, 2019 at 02:37:42PM -0700, Junio C Hamano wrote: > > > > +test_expect_success 'push --atomic also prevents branch creation' ' > > + # Make up/master > > + d=$HTTPD_DOCUMENT_ROOT_PATH/atomic-branches.git && > > + git init --bare "$d" && > > + git --git-dir="$d" config http.r

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Emily Shaffer
On Tue, Jul 02, 2019 at 01:16:46PM -0700, Junio C Hamano wrote: > Emily Shaffer writes: > > > + if ((flags & TRANSPORT_PUSH_ATOMIC) && err) { > > + for (struct ref *it = remote_refs; it; it = it->next) > > + switch (it->status) { > > +

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Junio C Hamano
Emily Shaffer writes: > Teach transport-helper how to notice if skipping a ref during push would > violate atomicity on the client side. We notice that a ref would be > rejected, and choose not to send it, but don't notice that if the client > has asked for --atomic we are violating atomicity if

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Junio C Hamano
Emily Shaffer writes: > + if ((flags & TRANSPORT_PUSH_ATOMIC) && err) { > + for (struct ref *it = remote_refs; it; it = it->next) > + switch (it->status) { > + case REF_STATUS_NONE: > +

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Junio C Hamano
Emily Shaffer writes: > diff --git a/transport-helper.c b/transport-helper.c > index c7e17ec9cb..6b05a88faf 100644 > --- a/transport-helper.c > +++ b/transport-helper.c > @@ -853,6 +853,7 @@ static int push_refs_with_push(struct transport > *transport, > { > int force_all = flags & TRANSP

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Junio C Hamano
Johannes Schindelin writes: >> +# Make master incompatible with up/master >> +git reset --hard HEAD^ && >> +# Add a new branch >> +git branch atomic && >> +# --atomic should roll back creation of up/atomic >> +test_must_fail git push --atomic "$up" master atomic && >> +

Re: [PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-02 Thread Johannes Schindelin
Hi Emily, On Mon, 1 Jul 2019, Emily Shaffer wrote: > Teach transport-helper how to notice if skipping a ref during push would > violate atomicity on the client side. We notice that a ref would be > rejected, and choose not to send it, but don't notice that if the client > has asked for --atomic w

[PATCH] transport-helper: enforce atomic in push_refs_with_push

2019-07-01 Thread Emily Shaffer
Teach transport-helper how to notice if skipping a ref during push would violate atomicity on the client side. We notice that a ref would be rejected, and choose not to send it, but don't notice that if the client has asked for --atomic we are violating atomicity if all the other pushes we are send