Teach git-index-pack how to keep a pack file.

To prevent a race condition between `index-pack --stdin` and
`repack -a -d` where the repack deletes the newly created pack
file before any refs are updated to reference objects contained
within it we mark the pack file as one that should be kept.  This
removes it from the list of packs that `repack -a -d` will consider
for removal.

Callers such as `receive-pack` which want to invoke `index-pack`
should use this new --keep option to prevent the newly created pack
and index file pair from being deleted before they have finished any
related ref updates.  Only after all ref updates have been finished
should the associated .keep file be removed.

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