commit-graph: new Bloom filter version that fixes murmur3

The murmur3 implementation in bloom.c has a bug when converting series
of 4 bytes into network-order integers when char is signed (which is
controllable by a compiler option, and the default signedness of char is
platform-specific). When a string contains characters with the high bit
set, this bug causes results that, although internally consistent within
Git, does not accord with other implementations of murmur3 (thus,
the changed path filters wouldn't be readable by other off-the-shelf
implementatios of murmur3) and even with Git binaries that were compiled
with different signedness of char. This bug affects both how Git writes
changed path filters to disk and how Git interprets changed path filters
on disk.

Therefore, introduce a new version (2) of changed path filters that
corrects this problem. The existing version (1) is still supported and
is still the default, but users should migrate away from it as soon
as possible.

Because this bug only manifests with characters that have the high bit
set, it may be possible that some (or all) commits in a given repo would
have the same changed path filter both before and after this fix is
applied. However, in order to determine whether this is the case, the
changed paths would first have to be computed, at which point it is not
much more expensive to just compute a new changed path filter.

So this patch does not include any mechanism to "salvage" changed path
filters from repositories. There is also no "mixed" mode - for each
invocation of Git, reading and writing changed path filters are done
with the same version number; this version number may be explicitly
stated (typically if the user knows which version they need) or
automatically determined from the version of the existing changed path
filters in the repository.

There is a change in write_commit_graph(). graph_read_bloom_data()
makes it possible for chunk_bloom_data to be non-NULL but
bloom_filter_settings to be NULL, which causes a segfault later on. I
produced such a segfault while developing this patch, but couldn't find
a way to reproduce it neither after this complete patch (or before),
but in any case it seemed like a good thing to include that might help
future patch authors.

The value in t0095 was obtained from another murmur3 implementation
using the following Go source code:

  package main

  import "fmt"
  import "github.com/spaolacci/murmur3"

  func main() {
          fmt.Printf("%x\n", murmur3.Sum32([]byte("Hello world!")))
          fmt.Printf("%x\n", murmur3.Sum32([]byte{0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}))
  }

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