Teach receive-pack how to keep pack files based on object count.

Since keeping a pushed pack or exploding it into loose objects
should be a local repository decision this teaches receive-pack
to decide if it should call unpack-objects or index-pack --stdin
--fix-thin based on the setting of receive.unpackLimit and the
number of objects contained in the received pack.

If the number of objects (hdr_entries) in the received pack is
below the value of receive.unpackLimit (which is 5000 by default)
then we unpack-objects as we have in the past.

If the hdr_entries >= receive.unpackLimit then we call index-pack and
ask it to include our pid and hostname in the .keep file to make it
easier to identify why a given pack has been kept in the repository.

Currently this leaves every received pack as a kept pack.  We really
don't want that as received packs will tend to be small.  Instead we
want to delete the .keep file automatically after all refs have
been updated.  That is being left as room for future improvement.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
4 files changed
tree: 9aa24c52b0571079e2c53910e1d8105c6e6ca005
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. gitweb/
  6. mozilla-sha1/
  7. perl/
  8. ppc/
  9. t/
  10. templates/
  11. xdiff/
  12. .gitignore
  13. alloc.c
  14. archive-tar.c
  15. archive-zip.c
  16. archive.h
  17. base85.c
  18. blame.c
  19. blob.c
  20. blob.h
  21. builtin-add.c
  22. builtin-annotate.c
  23. builtin-apply.c
  24. builtin-archive.c
  25. builtin-branch.c
  26. builtin-cat-file.c
  27. builtin-check-ref-format.c
  28. builtin-checkout-index.c
  29. builtin-commit-tree.c
  30. builtin-count-objects.c
  31. builtin-diff-files.c
  32. builtin-diff-index.c
  33. builtin-diff-stages.c
  34. builtin-diff-tree.c
  35. builtin-diff.c
  36. builtin-fmt-merge-msg.c
  37. builtin-for-each-ref.c
  38. builtin-grep.c
  39. builtin-init-db.c
  40. builtin-log.c
  41. builtin-ls-files.c
  42. builtin-ls-tree.c
  43. builtin-mailinfo.c
  44. builtin-mailsplit.c
  45. builtin-mv.c
  46. builtin-name-rev.c
  47. builtin-pack-objects.c
  48. builtin-pack-refs.c
  49. builtin-prune-packed.c
  50. builtin-prune.c
  51. builtin-push.c
  52. builtin-read-tree.c
  53. builtin-repo-config.c
  54. builtin-rev-list.c
  55. builtin-rev-parse.c
  56. builtin-rm.c
  57. builtin-runstatus.c
  58. builtin-show-branch.c
  59. builtin-show-ref.c
  60. builtin-stripspace.c
  61. builtin-symbolic-ref.c
  62. builtin-tar-tree.c
  63. builtin-unpack-objects.c
  64. builtin-update-index.c
  65. builtin-update-ref.c
  66. builtin-upload-archive.c
  67. builtin-verify-pack.c
  68. builtin-write-tree.c
  69. builtin.h
  70. cache-tree.c
  71. cache-tree.h
  72. cache.h
  73. check-racy.c
  74. color.c
  75. color.h
  76. combine-diff.c
  77. commit.c
  78. commit.h
  79. config.c
  80. config.mak.in
  81. configure.ac
  82. connect.c
  83. convert-objects.c
  84. copy.c
  85. COPYING
  86. csum-file.c
  87. csum-file.h
  88. ctype.c
  89. daemon.c
  90. date.c
  91. delta.h
  92. describe.c
  93. diff-delta.c
  94. diff-lib.c
  95. diff.c
  96. diff.h
  97. diffcore-break.c
  98. diffcore-delta.c
  99. diffcore-order.c
  100. diffcore-pickaxe.c
  101. diffcore-rename.c
  102. diffcore.h
  103. dir.c
  104. dir.h
  105. dump-cache-tree.c
  106. entry.c
  107. environment.c
  108. exec_cmd.c
  109. exec_cmd.h
  110. fetch-clone.c
  111. fetch-pack.c
  112. fetch.c
  113. fetch.h
  114. fsck-objects.c
  115. generate-cmdlist.sh
  116. git-am.sh
  117. git-applymbox.sh
  118. git-applypatch.sh
  119. git-archimport.perl
  120. git-bisect.sh
  121. git-checkout.sh
  122. git-cherry.sh
  123. git-clean.sh
  124. git-clone.sh
  125. git-commit.sh
  126. git-compat-util.h
  127. git-cvsexportcommit.perl
  128. git-cvsimport.perl
  129. git-cvsserver.perl
  130. git-fetch.sh
  131. git-instaweb.sh
  132. git-lost-found.sh
  133. git-ls-remote.sh
  134. git-merge-octopus.sh
  135. git-merge-one-file.sh
  136. git-merge-ours.sh
  137. git-merge-recursive-old.py
  138. git-merge-resolve.sh
  139. git-merge-stupid.sh
  140. git-merge.sh
  141. git-p4import.py
  142. git-parse-remote.sh
  143. git-pull.sh
  144. git-quiltimport.sh
  145. git-rebase.sh
  146. git-relink.perl
  147. git-repack.sh
  148. git-request-pull.sh
  149. git-rerere.perl
  150. git-reset.sh
  151. git-resolve.sh
  152. git-revert.sh
  153. git-send-email.perl
  154. git-sh-setup.sh
  155. git-shortlog.perl
  156. git-svn.perl
  157. git-svnimport.perl
  158. git-tag.sh
  159. git-verify-tag.sh
  160. GIT-VERSION-GEN
  161. git.c
  162. git.spec.in
  163. gitk
  164. gitMergeCommon.py
  165. grep.c
  166. grep.h
  167. hash-object.c
  168. help.c
  169. http-fetch.c
  170. http-push.c
  171. http.c
  172. http.h
  173. ident.c
  174. imap-send.c
  175. index-pack.c
  176. INSTALL
  177. interpolate.c
  178. interpolate.h
  179. list-objects.c
  180. list-objects.h
  181. local-fetch.c
  182. lockfile.c
  183. log-tree.c
  184. log-tree.h
  185. Makefile
  186. merge-base.c
  187. merge-file.c
  188. merge-index.c
  189. merge-recursive.c
  190. merge-tree.c
  191. mktag.c
  192. mktree.c
  193. object-refs.c
  194. object.c
  195. object.h
  196. pack-check.c
  197. pack-redundant.c
  198. pack.h
  199. pager.c
  200. patch-delta.c
  201. patch-id.c
  202. path-list.c
  203. path-list.h
  204. path.c
  205. peek-remote.c
  206. pkt-line.c
  207. pkt-line.h
  208. quote.c
  209. quote.h
  210. read-cache.c
  211. README
  212. receive-pack.c
  213. refs.c
  214. refs.h
  215. revision.c
  216. revision.h
  217. rsh.c
  218. rsh.h
  219. run-command.c
  220. run-command.h
  221. send-pack.c
  222. server-info.c
  223. setup.c
  224. sha1_file.c
  225. sha1_name.c
  226. shell.c
  227. show-index.c
  228. sideband.c
  229. sideband.h
  230. ssh-fetch.c
  231. ssh-pull.c
  232. ssh-push.c
  233. ssh-upload.c
  234. strbuf.c
  235. strbuf.h
  236. tag.c
  237. tag.h
  238. tar.h
  239. test-date.c
  240. test-delta.c
  241. test-sha1.c
  242. test-sha1.sh
  243. trace.c
  244. tree-diff.c
  245. tree-walk.c
  246. tree-walk.h
  247. tree.c
  248. tree.h
  249. unpack-file.c
  250. unpack-trees.c
  251. unpack-trees.h
  252. update-server-info.c
  253. upload-pack.c
  254. usage.c
  255. var.c
  256. write_or_die.c
  257. wt-status.c
  258. wt-status.h
  259. xdiff-interface.c
  260. xdiff-interface.h