tmp-objdir: new API for creating temporary writable databases

The tmp_objdir API provides the ability to create temporary object
directories, but was designed with the goal of having subprocesses
access these object stores, followed by the main process migrating
objects from it to the main object store or just deleting it.  The
subprocesses would view it as their primary datastore and write to it.

Here we add the tmp_objdir_replace_primary_odb function that replaces
the current process's writable "main" object directory with the
specified one. The previous main object directory is restored in either
tmp_objdir_migrate or tmp_objdir_destroy.

For the --remerge-diff usecase, add a new `will_destroy` flag in `struct
object_database` to mark ephemeral object databases that do not require
fsync durability.

Add 'git prune' support for removing temporary object databases, and
make sure that they have a name starting with tmp_ and containing an
operation-specific name.

Based-on-patch-by: Elijah Newren <newren@gmail.com>

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 files changed
tree: ae4937eebd6d08bb828dd1967d043369c496c945
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. negotiator/
  14. perl/
  15. po/
  16. ppc/
  17. refs/
  18. sha1dc/
  19. sha256/
  20. t/
  21. templates/
  22. trace2/
  23. xdiff/
  24. .cirrus.yml
  25. .clang-format
  26. .editorconfig
  27. .gitattributes
  28. .gitignore
  29. .gitmodules
  30. .mailmap
  31. .travis.yml
  32. .tsan-suppressions
  33. abspath.c
  34. aclocal.m4
  35. add-interactive.c
  36. add-interactive.h
  37. add-patch.c
  38. advice.c
  39. advice.h
  40. alias.c
  41. alias.h
  42. alloc.c
  43. alloc.h
  44. apply.c
  45. apply.h
  46. archive-tar.c
  47. archive-zip.c
  48. archive.c
  49. archive.h
  50. attr.c
  51. attr.h
  52. banned.h
  53. base85.c
  54. bisect.c
  55. bisect.h
  56. blame.c
  57. blame.h
  58. blob.c
  59. blob.h
  60. bloom.c
  61. bloom.h
  62. branch.c
  63. branch.h
  64. builtin.h
  65. bulk-checkin.c
  66. bulk-checkin.h
  67. bundle.c
  68. bundle.h
  69. cache-tree.c
  70. cache-tree.h
  71. cache.h
  72. cbtree.c
  73. cbtree.h
  74. chdir-notify.c
  75. chdir-notify.h
  76. check-builtins.sh
  77. checkout.c
  78. checkout.h
  79. chunk-format.c
  80. chunk-format.h
  81. CODE_OF_CONDUCT.md
  82. color.c
  83. color.h
  84. column.c
  85. column.h
  86. combine-diff.c
  87. command-list.txt
  88. commit-graph.c
  89. commit-graph.h
  90. commit-reach.c
  91. commit-reach.h
  92. commit-slab-decl.h
  93. commit-slab-impl.h
  94. commit-slab.h
  95. commit.c
  96. commit.h
  97. common-main.c
  98. config.c
  99. config.h
  100. config.mak.dev
  101. config.mak.in
  102. config.mak.uname
  103. configure.ac
  104. connect.c
  105. connect.h
  106. connected.c
  107. connected.h
  108. convert.c
  109. convert.h
  110. copy.c
  111. COPYING
  112. credential.c
  113. credential.h
  114. csum-file.c
  115. csum-file.h
  116. ctype.c
  117. daemon.c
  118. date.c
  119. decorate.c
  120. decorate.h
  121. delta-islands.c
  122. delta-islands.h
  123. delta.h
  124. detect-compiler
  125. diff-delta.c
  126. diff-lib.c
  127. diff-merges.c
  128. diff-merges.h
  129. diff-no-index.c
  130. diff.c
  131. diff.h
  132. diffcore-break.c
  133. diffcore-delta.c
  134. diffcore-order.c
  135. diffcore-pickaxe.c
  136. diffcore-rename.c
  137. diffcore-rotate.c
  138. diffcore.h
  139. dir-iterator.c
  140. dir-iterator.h
  141. dir.c
  142. dir.h
  143. editor.c
  144. entry.c
  145. entry.h
  146. environment.c
  147. environment.h
  148. exec-cmd.c
  149. exec-cmd.h
  150. fetch-negotiator.c
  151. fetch-negotiator.h
  152. fetch-pack.c
  153. fetch-pack.h
  154. fmt-merge-msg.c
  155. fmt-merge-msg.h
  156. fsck.c
  157. fsck.h
  158. fsmonitor.c
  159. fsmonitor.h
  160. fuzz-commit-graph.c
  161. fuzz-pack-headers.c
  162. fuzz-pack-idx.c
  163. generate-cmdlist.sh
  164. generate-configlist.sh
  165. gettext.c
  166. gettext.h
  167. git-add--interactive.perl
  168. git-archimport.perl
  169. git-bisect.sh
  170. git-compat-util.h
  171. git-curl-compat.h
  172. git-cvsexportcommit.perl
  173. git-cvsimport.perl
  174. git-cvsserver.perl
  175. git-difftool--helper.sh
  176. git-filter-branch.sh
  177. git-instaweb.sh
  178. git-merge-octopus.sh
  179. git-merge-one-file.sh
  180. git-merge-resolve.sh
  181. git-mergetool--lib.sh
  182. git-mergetool.sh
  183. git-p4.py
  184. git-quiltimport.sh
  185. git-rebase--preserve-merges.sh
  186. git-request-pull.sh
  187. git-send-email.perl
  188. git-sh-i18n.sh
  189. git-sh-setup.sh
  190. git-submodule.sh
  191. git-svn.perl
  192. GIT-VERSION-GEN
  193. git-web--browse.sh
  194. git.c
  195. git.rc
  196. gpg-interface.c
  197. gpg-interface.h
  198. graph.c
  199. graph.h
  200. grep.c
  201. grep.h
  202. hash-lookup.c
  203. hash-lookup.h
  204. hash.h
  205. hashmap.c
  206. hashmap.h
  207. help.c
  208. help.h
  209. hex.c
  210. http-backend.c
  211. http-fetch.c
  212. http-push.c
  213. http-walker.c
  214. http.c
  215. http.h
  216. ident.c
  217. imap-send.c
  218. INSTALL
  219. iterator.h
  220. json-writer.c
  221. json-writer.h
  222. khash.h
  223. kwset.c
  224. kwset.h
  225. levenshtein.c
  226. levenshtein.h
  227. LGPL-2.1
  228. line-log.c
  229. line-log.h
  230. line-range.c
  231. line-range.h
  232. linear-assignment.c
  233. linear-assignment.h
  234. list-objects-filter-options.c
  235. list-objects-filter-options.h
  236. list-objects-filter.c
  237. list-objects-filter.h
  238. list-objects.c
  239. list-objects.h
  240. list.h
  241. ll-merge.c
  242. ll-merge.h
  243. lockfile.c
  244. lockfile.h
  245. log-tree.c
  246. log-tree.h
  247. ls-refs.c
  248. ls-refs.h
  249. mailinfo.c
  250. mailinfo.h
  251. mailmap.c
  252. mailmap.h
  253. Makefile
  254. match-trees.c
  255. mem-pool.c
  256. mem-pool.h
  257. merge-blobs.c
  258. merge-blobs.h
  259. merge-ort-wrappers.c
  260. merge-ort-wrappers.h
  261. merge-ort.c
  262. merge-ort.h
  263. merge-recursive.c
  264. merge-recursive.h
  265. merge.c
  266. mergesort.c
  267. mergesort.h
  268. midx.c
  269. midx.h
  270. name-hash.c
  271. notes-cache.c
  272. notes-cache.h
  273. notes-merge.c
  274. notes-merge.h
  275. notes-utils.c
  276. notes-utils.h
  277. notes.c
  278. notes.h
  279. object-file.c
  280. object-name.c
  281. object-store.h
  282. object.c
  283. object.h
  284. oid-array.c
  285. oid-array.h
  286. oidmap.c
  287. oidmap.h
  288. oidset.c
  289. oidset.h
  290. oidtree.c
  291. oidtree.h
  292. pack-bitmap-write.c
  293. pack-bitmap.c
  294. pack-bitmap.h
  295. pack-check.c
  296. pack-objects.c
  297. pack-objects.h
  298. pack-revindex.c
  299. pack-revindex.h
  300. pack-write.c
  301. pack.h
  302. packfile.c
  303. packfile.h
  304. pager.c
  305. parallel-checkout.c
  306. parallel-checkout.h
  307. parse-options-cb.c
  308. parse-options.c
  309. parse-options.h
  310. patch-delta.c
  311. patch-ids.c
  312. patch-ids.h
  313. path.c
  314. path.h
  315. pathspec.c
  316. pathspec.h
  317. pkt-line.c
  318. pkt-line.h
  319. preload-index.c
  320. pretty.c
  321. pretty.h
  322. prio-queue.c
  323. prio-queue.h
  324. progress.c
  325. progress.h
  326. promisor-remote.c
  327. promisor-remote.h
  328. prompt.c
  329. prompt.h
  330. protocol-caps.c
  331. protocol-caps.h
  332. protocol.c
  333. protocol.h
  334. prune-packed.c
  335. prune-packed.h
  336. quote.c
  337. quote.h
  338. range-diff.c
  339. range-diff.h
  340. reachable.c
  341. reachable.h
  342. read-cache.c
  343. README.md
  344. rebase-interactive.c
  345. rebase-interactive.h
  346. rebase.c
  347. rebase.h
  348. ref-filter.c
  349. ref-filter.h
  350. reflog-walk.c
  351. reflog-walk.h
  352. refs.c
  353. refs.h
  354. refspec.c
  355. refspec.h
  356. remote-curl.c
  357. remote.c
  358. remote.h
  359. replace-object.c
  360. replace-object.h
  361. repo-settings.c
  362. repository.c
  363. repository.h
  364. rerere.c
  365. rerere.h
  366. reset.c
  367. reset.h
  368. resolve-undo.c
  369. resolve-undo.h
  370. revision.c
  371. revision.h
  372. run-command.c
  373. run-command.h
  374. SECURITY.md
  375. send-pack.c
  376. send-pack.h
  377. sequencer.c
  378. sequencer.h
  379. serve.c
  380. serve.h
  381. server-info.c
  382. setup.c
  383. sh-i18n--envsubst.c
  384. sha1dc_git.c
  385. sha1dc_git.h
  386. shallow.c
  387. shallow.h
  388. shell.c
  389. shortlog.h
  390. sideband.c
  391. sideband.h
  392. sigchain.c
  393. sigchain.h
  394. simple-ipc.h
  395. sparse-index.c
  396. sparse-index.h
  397. split-index.c
  398. split-index.h
  399. stable-qsort.c
  400. strbuf.c
  401. strbuf.h
  402. streaming.c
  403. streaming.h
  404. string-list.c
  405. string-list.h
  406. strmap.c
  407. strmap.h
  408. strvec.c
  409. strvec.h
  410. sub-process.c
  411. sub-process.h
  412. submodule-config.c
  413. submodule-config.h
  414. submodule.c
  415. submodule.h
  416. symlinks.c
  417. tag.c
  418. tag.h
  419. tar.h
  420. tempfile.c
  421. tempfile.h
  422. thread-utils.c
  423. thread-utils.h
  424. tmp-objdir.c
  425. tmp-objdir.h
  426. trace.c
  427. trace.h
  428. trace2.c
  429. trace2.h
  430. trailer.c
  431. trailer.h
  432. transport-helper.c
  433. transport-internal.h
  434. transport.c
  435. transport.h
  436. tree-diff.c
  437. tree-walk.c
  438. tree-walk.h
  439. tree.c
  440. tree.h
  441. unicode-width.h
  442. unimplemented.sh
  443. unix-socket.c
  444. unix-socket.h
  445. unix-stream-server.c
  446. unix-stream-server.h
  447. unpack-trees.c
  448. unpack-trees.h
  449. upload-pack.c
  450. upload-pack.h
  451. url.c
  452. url.h
  453. urlmatch.c
  454. urlmatch.h
  455. usage.c
  456. userdiff.c
  457. userdiff.h
  458. utf8.c
  459. utf8.h
  460. varint.c
  461. varint.h
  462. version.c
  463. version.h
  464. versioncmp.c
  465. walker.c
  466. walker.h
  467. wildmatch.c
  468. wildmatch.h
  469. worktree.c
  470. worktree.h
  471. wrap-for-bin.sh
  472. wrapper.c
  473. write-or-die.c
  474. ws.c
  475. wt-status.c
  476. wt-status.h
  477. xdiff-interface.c
  478. xdiff-interface.h
  479. zlib.c
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-<commandname>.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://lore.kernel.org/git/, http://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks