All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Todd Zullinger <tmz@pobox.com>
Cc: Shikher Verma <root@shikherverma.com>,
	git@vger.kernel.org, santiago@nyu.edu, sbeller@google.com
Subject: Re: [PATCH] Add a sample hook which saves push certs as notes
Date: Sat, 02 Dec 2017 22:05:32 -0800	[thread overview]
Message-ID: <xmqq609ojqhf.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171203004543.GO3693@zaya.teonanacatl.net> (Todd Zullinger's message of "Sat, 2 Dec 2017 19:45:43 -0500")

Todd Zullinger <tmz@pobox.com> writes:

> (I also noticed the tests which use $GIT_PUSH_CERT, like t5534, use
> 'cat-file blob ...' rather than 'cat-file -p ...'.  I don't know if
> that's much safer/better than letting cat-file guess the object type
> in the hook.

The '-p' option is meant for human consumption and we promise that
the output from it _will_ change if it makes sense at the UI level.

In a script like this, you do care about the exact byte sequence.
So that is a more important reason why you should say "blob" not
"-p".

>> +	# Verify that the ref update matches that in push certificate.
>> +	if [[ $push_cert == *$oval" "$nval" "$ref* ]]; then

I am not sure what this expression is trying to do in the first
place.  The contents of the push certificate blob may contain these
three values, but has a lot more than that.

A post-receive is run after all the receive processing is done, so
its failing cannot abort the transfer.  I wonder how an almost
simultaneous push to a same ref, that would not fail normally
without this new hook script, would behave.  One receive updates the
tip from A to B and then starts running this script, while the other
receive updates the tip from B to C and then starts running another
copy of the script.  They both wants to update the notes database
but there can be only one winner in the race for its tip.  

What happens then?  Don't we need to be running a script like this
from a hook mechanism that runs under a lock or something?

  reply	other threads:[~2017-12-03  6:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170906093913.21485-1-root@shikherverma.com>
2017-09-06 21:31 ` [RFC PATCH 0/2] Add named reference to latest push cert Stefan Beller
2017-09-07  0:55   ` Junio C Hamano
2017-09-07  8:55     ` Shikher Verma
2017-09-07  9:11   ` Shikher Verma
2017-09-07 17:43     ` Stefan Beller
2017-09-16  7:21       ` Shikher Verma
2017-09-17  1:40         ` Junio C Hamano
2017-09-18 14:22           ` Santiago Torres
2017-09-18 17:43             ` Stefan Beller
2017-09-19  1:04             ` Junio C Hamano
2017-09-19  3:11               ` Junio C Hamano
2017-12-02  9:12                 ` [PATCH] Add a sample hook which saves push certs as notes Shikher Verma
2017-12-03  0:45                   ` Todd Zullinger
2017-12-03  6:05                     ` Junio C Hamano [this message]
2017-09-07  7:08 ` [RFC PATCH 0/2] Add named reference to latest push cert Shikher Verma
2017-09-07 17:21   ` Stefan Beller

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=xmqq609ojqhf.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=root@shikherverma.com \
    --cc=santiago@nyu.edu \
    --cc=sbeller@google.com \
    --cc=tmz@pobox.com \
    /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.