midx: allow marking a pack as preferred

When multiple packs in the multi-pack index contain the same object, the
MIDX machinery must make a choice about which pack it associates with
that object. Prior to this patch, the lowest-ordered[1] pack was always
selected.

Pack selection for duplicate objects is relatively unimportant today,
but it will become important for multi-pack bitmaps. This is because we
can only invoke the pack-reuse mechanism when all of the bits for reused
objects come from the reuse pack (in order to ensure that all reused
deltas can find their base objects in the same pack).

To encourage the pack selection process to prefer one pack over another
(the pack to be preferred is the one a caller would like to later use as
a reuse pack), introduce the concept of a "preferred pack". When
provided, the MIDX code will always prefer an object found in a
preferred pack over any other.

No format changes are required to store the preferred pack, since it
will be able to be inferred with a corresponding MIDX bitmap, by looking
up the pack associated with the object in the first bit position (this
ordering is described in detail in a subsequent commit).

[1]: the ordering is specified by MIDX internals; for our purposes we
can consider the "lowest ordered" pack to be "the one with the
most-recent mtime.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 files changed
tree: 04e21a6dcb3a8f1e11c151597a5fcf31be20f44d
  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. vcs-svn/
  24. xdiff/
  25. .cirrus.yml
  26. .clang-format
  27. .editorconfig
  28. .gitattributes
  29. .gitignore
  30. .gitmodules
  31. .mailmap
  32. .travis.yml
  33. .tsan-suppressions
  34. abspath.c
  35. aclocal.m4
  36. add-interactive.c
  37. add-interactive.h
  38. add-patch.c
  39. advice.c
  40. advice.h
  41. alias.c
  42. alias.h
  43. alloc.c
  44. alloc.h
  45. apply.c
  46. apply.h
  47. archive-tar.c
  48. archive-zip.c
  49. archive.c
  50. archive.h
  51. attr.c
  52. attr.h
  53. banned.h
  54. base85.c
  55. bisect.c
  56. bisect.h
  57. blame.c
  58. blame.h
  59. blob.c
  60. blob.h
  61. bloom.c
  62. bloom.h
  63. branch.c
  64. branch.h
  65. builtin.h
  66. bulk-checkin.c
  67. bulk-checkin.h
  68. bundle.c
  69. bundle.h
  70. cache-tree.c
  71. cache-tree.h
  72. cache.h
  73. chdir-notify.c
  74. chdir-notify.h
  75. check-builtins.sh
  76. check_bindir
  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.h
  138. dir-iterator.c
  139. dir-iterator.h
  140. dir.c
  141. dir.h
  142. editor.c
  143. entry.c
  144. environment.c
  145. environment.h
  146. exec-cmd.c
  147. exec-cmd.h
  148. fetch-negotiator.c
  149. fetch-negotiator.h
  150. fetch-pack.c
  151. fetch-pack.h
  152. fmt-merge-msg.c
  153. fmt-merge-msg.h
  154. fsck.c
  155. fsck.h
  156. fsmonitor.c
  157. fsmonitor.h
  158. fuzz-commit-graph.c
  159. fuzz-pack-headers.c
  160. fuzz-pack-idx.c
  161. generate-cmdlist.sh
  162. generate-configlist.sh
  163. gettext.c
  164. gettext.h
  165. git-add--interactive.perl
  166. git-archimport.perl
  167. git-bisect.sh
  168. git-compat-util.h
  169. git-cvsexportcommit.perl
  170. git-cvsimport.perl
  171. git-cvsserver.perl
  172. git-difftool--helper.sh
  173. git-filter-branch.sh
  174. git-instaweb.sh
  175. git-merge-octopus.sh
  176. git-merge-one-file.sh
  177. git-merge-resolve.sh
  178. git-mergetool--lib.sh
  179. git-mergetool.sh
  180. git-p4.py
  181. git-quiltimport.sh
  182. git-rebase--preserve-merges.sh
  183. git-request-pull.sh
  184. git-send-email.perl
  185. git-sh-i18n.sh
  186. git-sh-setup.sh
  187. git-submodule.sh
  188. git-svn.perl
  189. GIT-VERSION-GEN
  190. git-web--browse.sh
  191. git.c
  192. git.rc
  193. gpg-interface.c
  194. gpg-interface.h
  195. graph.c
  196. graph.h
  197. grep.c
  198. grep.h
  199. hash-lookup.c
  200. hash-lookup.h
  201. hash.h
  202. hashmap.c
  203. hashmap.h
  204. help.c
  205. help.h
  206. hex.c
  207. http-backend.c
  208. http-fetch.c
  209. http-push.c
  210. http-walker.c
  211. http.c
  212. http.h
  213. ident.c
  214. imap-send.c
  215. INSTALL
  216. iterator.h
  217. json-writer.c
  218. json-writer.h
  219. khash.h
  220. kwset.c
  221. kwset.h
  222. levenshtein.c
  223. levenshtein.h
  224. LGPL-2.1
  225. line-log.c
  226. line-log.h
  227. line-range.c
  228. line-range.h
  229. linear-assignment.c
  230. linear-assignment.h
  231. list-objects-filter-options.c
  232. list-objects-filter-options.h
  233. list-objects-filter.c
  234. list-objects-filter.h
  235. list-objects.c
  236. list-objects.h
  237. list.h
  238. ll-merge.c
  239. ll-merge.h
  240. lockfile.c
  241. lockfile.h
  242. log-tree.c
  243. log-tree.h
  244. ls-refs.c
  245. ls-refs.h
  246. mailinfo.c
  247. mailinfo.h
  248. mailmap.c
  249. mailmap.h
  250. Makefile
  251. match-trees.c
  252. mem-pool.c
  253. mem-pool.h
  254. merge-blobs.c
  255. merge-blobs.h
  256. merge-ort-wrappers.c
  257. merge-ort-wrappers.h
  258. merge-ort.c
  259. merge-ort.h
  260. merge-recursive.c
  261. merge-recursive.h
  262. merge.c
  263. mergesort.c
  264. mergesort.h
  265. midx.c
  266. midx.h
  267. name-hash.c
  268. notes-cache.c
  269. notes-cache.h
  270. notes-merge.c
  271. notes-merge.h
  272. notes-utils.c
  273. notes-utils.h
  274. notes.c
  275. notes.h
  276. object-file.c
  277. object-name.c
  278. object-store.h
  279. object.c
  280. object.h
  281. oid-array.c
  282. oid-array.h
  283. oidmap.c
  284. oidmap.h
  285. oidset.c
  286. oidset.h
  287. pack-bitmap-write.c
  288. pack-bitmap.c
  289. pack-bitmap.h
  290. pack-check.c
  291. pack-objects.c
  292. pack-objects.h
  293. pack-revindex.c
  294. pack-revindex.h
  295. pack-write.c
  296. pack.h
  297. packfile.c
  298. packfile.h
  299. pager.c
  300. parse-options-cb.c
  301. parse-options.c
  302. parse-options.h
  303. patch-delta.c
  304. patch-ids.c
  305. patch-ids.h
  306. path.c
  307. path.h
  308. pathspec.c
  309. pathspec.h
  310. pkt-line.c
  311. pkt-line.h
  312. preload-index.c
  313. pretty.c
  314. pretty.h
  315. prio-queue.c
  316. prio-queue.h
  317. progress.c
  318. progress.h
  319. promisor-remote.c
  320. promisor-remote.h
  321. prompt.c
  322. prompt.h
  323. protocol.c
  324. protocol.h
  325. prune-packed.c
  326. prune-packed.h
  327. quote.c
  328. quote.h
  329. range-diff.c
  330. range-diff.h
  331. reachable.c
  332. reachable.h
  333. read-cache.c
  334. README.md
  335. rebase-interactive.c
  336. rebase-interactive.h
  337. rebase.c
  338. rebase.h
  339. ref-filter.c
  340. ref-filter.h
  341. reflog-walk.c
  342. reflog-walk.h
  343. refs.c
  344. refs.h
  345. refspec.c
  346. refspec.h
  347. remote-curl.c
  348. remote.c
  349. remote.h
  350. replace-object.c
  351. replace-object.h
  352. repo-settings.c
  353. repository.c
  354. repository.h
  355. rerere.c
  356. rerere.h
  357. reset.c
  358. reset.h
  359. resolve-undo.c
  360. resolve-undo.h
  361. revision.c
  362. revision.h
  363. run-command.c
  364. run-command.h
  365. send-pack.c
  366. send-pack.h
  367. sequencer.c
  368. sequencer.h
  369. serve.c
  370. serve.h
  371. server-info.c
  372. setup.c
  373. sh-i18n--envsubst.c
  374. sha1dc_git.c
  375. sha1dc_git.h
  376. shallow.c
  377. shallow.h
  378. shell.c
  379. shortlog.h
  380. sideband.c
  381. sideband.h
  382. sigchain.c
  383. sigchain.h
  384. split-index.c
  385. split-index.h
  386. stable-qsort.c
  387. strbuf.c
  388. strbuf.h
  389. streaming.c
  390. streaming.h
  391. string-list.c
  392. string-list.h
  393. strmap.c
  394. strmap.h
  395. strvec.c
  396. strvec.h
  397. sub-process.c
  398. sub-process.h
  399. submodule-config.c
  400. submodule-config.h
  401. submodule.c
  402. submodule.h
  403. symlinks.c
  404. tag.c
  405. tag.h
  406. tar.h
  407. tempfile.c
  408. tempfile.h
  409. thread-utils.c
  410. thread-utils.h
  411. tmp-objdir.c
  412. tmp-objdir.h
  413. trace.c
  414. trace.h
  415. trace2.c
  416. trace2.h
  417. trailer.c
  418. trailer.h
  419. transport-helper.c
  420. transport-internal.h
  421. transport.c
  422. transport.h
  423. tree-diff.c
  424. tree-walk.c
  425. tree-walk.h
  426. tree.c
  427. tree.h
  428. unicode-width.h
  429. unimplemented.sh
  430. unix-socket.c
  431. unix-socket.h
  432. unpack-trees.c
  433. unpack-trees.h
  434. upload-pack.c
  435. upload-pack.h
  436. url.c
  437. url.h
  438. urlmatch.c
  439. urlmatch.h
  440. usage.c
  441. userdiff.c
  442. userdiff.h
  443. utf8.c
  444. utf8.h
  445. varint.c
  446. varint.h
  447. version.c
  448. version.h
  449. versioncmp.c
  450. walker.c
  451. walker.h
  452. wildmatch.c
  453. wildmatch.h
  454. worktree.c
  455. worktree.h
  456. wrap-for-bin.sh
  457. wrapper.c
  458. write-or-die.c
  459. ws.c
  460. wt-status.c
  461. wt-status.h
  462. xdiff-interface.c
  463. xdiff-interface.h
  464. 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