MIDX: revert the default version to v1

We introduced midx version 2 in b2ec8e90c2 (midx: do not require packs
to be sorted in lexicographic order, 2026-02-24) and now write it by
default. The rationale was that older versions should ignore the v2 midx
and fall back to using the packs (just like we do for other midx
errors). Unfortunately this is not the case, as we have a hard die()
when we see an unknown midx version.

As a result, writing a midx with Git 2.54-rc2 puts the repository into a
state that is unusable with Git 2.53. And this midx write may happen
behind the scenes as part of normal operations, like fetch.

Let's switch back to writing v1 by default to avoid regressing the case
where multiple versions of Git are used on the same repository.

There is one gotcha, though: the v2 format is required for some new
features, like midx compaction, and running "git multi-pack-index
compact" will complain when asked to write a v1 index. The user must set
midx.version to "2" to make the feature work.

So instead of always using v1, we'll base the default on whether the
requested feature requires v2. That does mean that running midx
compaction will create a repository that can't be read by older versions
of Git. But we never do that by default; only people experimenting with
the new feature will be affected.

We have to adjust the test expectation in t5319, since it will now
generate v1 files. And our "auto-select v2" is covered by the tests in
t5335, which continue to check that compaction works without having to
set midx.version manually (and also explicitly check that asking for v1
with compaction reports the problem).

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

Those wishing to help with error message, usage and informational message string translations (localization l10) should see po/README.md (a po file is a Portable Object file that holds the translations).

To subscribe to the list, send an email to git+subscribe@vger.kernel.org (see https://subspace.kernel.org/subscribing.html for details). The mailing list archives are available at https://lore.kernel.org/git/, https://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