git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Detecting pushes originating from shallow clones?

From
OJOwen Jacobson <ojacobson@heroku.com>
Date
Nov 30, 2015, 22:27 UTC
Message-ID
<147913FA-1158-40BE-8365-B90E3CBD79C7@heroku.com>
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?
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, so I thought I’d see if anyone here has a better idea.
Thanks,
-o
Next: Junio C Hamano
Message 1 of 3 in “Detecting pushes originating from shallow clones?”
  1. Owen JacobsonNov 30, 2015
  2. Junio C HamanoNov 30, 2015
  3. Owen JacobsonNov 30, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.