From: Junio C Hamano <gitster@pobox.com>
To: Owen Jacobson <ojacobson@heroku.com>
Cc: git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: Detecting pushes originating from shallow clones?
Date: Mon, 30 Nov 2015 14:52:18 -0800 [thread overview]
Message-ID: <xmqqr3j76qxp.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <147913FA-1158-40BE-8365-B90E3CBD79C7@heroku.com> (Owen Jacobson's message of "Mon, 30 Nov 2015 17:27:31 -0500")
Owen Jacobson <ojacobson@heroku.com> writes:
> Hi folks,
>
> Here at Heroku, we ingest code from users by supplying them with a
> Git server they can `git push` into. Occasionally, users will
> attempt to push to us from a shallow clone, which causes numerous
> problems for us and, often, for our users (incomplete
> repositories, gaps in history, failed builds, and a host of other
> problems). We’ve been investigating what we can do to give these
> users clearer advice on how to fix the problem.
>
> Within the constraints that
>
> * we cannot control which version of Git our users have installed, and
> * we run Git v1.9.1, obtained from the Ubuntu 14.04 LTS .deb repositories
>
> what can we do in an update/pre-receive hook to detect that an
> incoming push originates from a shallow repository and reject it?
Hmm, I would have suggested to set receive.fsckObjects which has
been around since early 2008 (it is in v1.5.6, so it would likely be
in v1.9.1 as well).
But even without that configuration set, "push" shouldn't leave the
receiving repository in an inconsistent state (e.g. incomplete
repository, gaps in history) in the first place.
Does anybody recall us having such a bug in the distant past in
1.9.1 and fixing it? I do not offhand recall but I wouldn't be
surprised.
> Right now, the best strategy we have is to observe whether
>
> git rev-list OLD NEW
>
> fails, and if it does fail, whether the stderr output includes the
> phrase "revision walk setup failed”. This feels like a fairly
> weak fix ...
Actually, that (with "--objects" option) is essentially the test the
receiving end does internally to detect the "gaps in history" when
receive.fsckObjects configuration is set.
next prev parent reply other threads:[~2015-11-30 22:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-30 22:27 Detecting pushes originating from shallow clones? Owen Jacobson
2015-11-30 22:52 ` Junio C Hamano [this message]
2015-11-30 23:11 ` Owen Jacobson
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=xmqqr3j76qxp.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ojacobson@heroku.com \
--cc=pclouds@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