From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Scott Sandler <scott.m.sandler@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git push race condition?
Date: Mon, 24 Mar 2014 23:09:36 +0100 [thread overview]
Message-ID: <vpqa9cf9rkv.fsf@anie.imag.fr> (raw)
In-Reply-To: <CAAyEjTNPqPHswbrrV9pRyXUUqD8dYzJaXQpWr+g3kuBERNLMRw@mail.gmail.com> (Scott Sandler's message of "Mon, 24 Mar 2014 16:01:32 -0400")
Scott Sandler <scott.m.sandler@gmail.com> writes:
> It's a bare repo and I didn't realize server-side reflogs were a
> thing. Just ran "git config core.logallrefupdates true" in the repo on
> the server which seems to be what I should do to enable that.
That should be it, yes.
> The server does know about B, it shows up when you do "git show B".
> However "git branch --contains B" returns nothing.
That is "normal": git push sends objects to the object store in a
lockless manner, and then updates the reference corresponding to the
branch you're pushing to. So in case of concurrent access, the objects
may be sent, but the reference update will fail. Objects would be
garbage collected by a further "git gc [--prune]".
The "not normal" part is that the race condition on the ref update does
actually break for you.
> Gitlab's update hook maintains an event log when any push event
> happens, who pushed and which commits. The most recent time this
> happened, the first push which was lost occured at 2014-03-24 19:04:51
> and the one that overwrote it happened at 2014-03-24 19:05:04. That's
> when the update hook ran, not necessarily when the user hit "git
> push", but it is notable that it's 13 seconds apart which is a pretty
> long time. We do run several hooks for checking coding syntax and
> various other things so it's believable to me that the hooks would
> take more than 13 seconds on occasion, but based on the testing I did
> with the sleep hook it didn't seem like the hooks were actually the
> problem.
Are you really, really, really sure that there's no force-push involved?
(either "push --force" or "push remotename +branchname")
What you describe really looks like a force-push, or a hook doing a ref
update (e.g. a hook on a dev branch that updates master if the code
passes tests or so).
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2014-03-24 22:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-24 19:18 Git push race condition? Scott Sandler
2014-03-24 19:44 ` Matthieu Moy
2014-03-24 20:01 ` Scott Sandler
2014-03-24 22:09 ` Matthieu Moy [this message]
2014-03-24 22:44 ` Junio C Hamano
2014-03-24 21:16 ` Ævar Arnfjörð Bjarmason
2014-03-24 21:29 ` Scott Sandler
2014-03-24 22:51 ` Jeff King
2014-03-24 22:54 ` Jeff King
2014-03-24 22:59 ` Nasser Grainawi
2014-03-25 13:45 ` Scott Sandler
2014-03-25 14:03 ` Matthieu Moy
2014-03-25 14:16 ` Scott Sandler
2014-03-25 14:22 ` Matthieu Moy
2014-03-25 14:57 ` Jeff King
2014-04-10 19:14 ` Scott Sandler
2014-04-11 7:46 ` Matthieu Moy
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=vpqa9cf9rkv.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=scott.m.sandler@gmail.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 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 NNTP newsgroup(s).