receive-pack: never unpack git-receive-pack packs
commit112881a1c6aa474c28b6a7d39b81ea5fc399c165
authorKyle J. McKay <mackyle@gmail.com>
Sun, 8 May 2016 00:54:32 +0000 (7 17:54 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Sun, 8 May 2016 00:54:32 +0000 (7 17:54 -0700)
tree7ec513bdb79feaf17260eb7ea09bc68994b30e89
parent50dbb345441cf6d299f4ffcdfea7481587203c83
receive-pack: never unpack git-receive-pack packs

Git has a race condition where a simultaneous garbage collection
(even one triggered by "git gc --auto") and push (i.e. git-receive-pack)
can result in a loose object that is just becoming referenced being
deleted even though it's actually now referenced or about to be referenced.

Because the .pack mechanism supports .keep files, this same problem
cannot occur if incoming pushes always store the new objects as packs
and never unpack them.  (There is no .keep mechanism for loose objects.)

To this end, force receive.unpackLimit to be set to 1 whenever an
incoming push (i.e. git-receive-pack) occurs.  We do this in such a
way that it will override any config file settings because it's crucial
that it not be bypassed.

Unfortunately the Git documenation is wrong in that it claims that
transfer.unpackLimit is a fallback when receive.unpackLimit (or
fetch.unpackLimit) is unset.  In fact, the code behaves in the exact
opposite fashion. If transfer.unpackLimit is set the other two are
completely ignored.

Therefore we also always force transfer.unpackLimit to be set to 1
as well whenever we are forcing receive.unpackLimit to be set to 1.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
bin/git-http-backend-verify
bin/git-shell-verify