pack-bitmap: avoid traversal of objects referenced by uninteresting tag

When preparing the bitmap walk, we first establish the set of of have
and want objects by iterating over the set of pending objects: if an
object is marked as uninteresting, it's declared as an object we already
have, otherwise as an object we want. These two sets are then used to
compute which transitively referenced objects we need to obtain.

One special case here are tag objects: when a tag is requested, we
resolve it to its first not-tag object and add both resolved objects as
well as the tag itself into either the have or want set. Given that the
uninteresting-property always propagates to referenced objects, it is
clear that if the tag is uninteresting, so are its children and vice
versa. But we fail to propagate the flag, which effectively means that
referenced objects will always be interesting except for the case where
they have already been marked as uninteresting explicitly.

This mislabeling does not impact correctness: we now have it in our
"wants" set, and given that we later do an `AND NOT` of the bitmaps of
"wants" and "haves" sets it is clear that the result must be the same.
But we now start to needlessly traverse the tag's referenced objects in
case it is uninteresting, even though we know that each referenced
object will be uninteresting anyway. In the worst case, this can lead to
a complete graph walk just to establish that we do not care for any
object.

Fix the issue by propagating the `UNINTERESTING` flag to pointees of tag
objects and add a benchmark with negative revisions to p5310. This shows
some nice performance benefits, tested with linux.git:

Test                                                          HEAD~                  HEAD
---------------------------------------------------------------------------------------------------------------
5310.3: repack to disk                                        193.18(181.46+16.42)   194.61(183.41+15.83) +0.7%
5310.4: simulated clone                                       25.93(24.88+1.05)      25.81(24.73+1.08) -0.5%
5310.5: simulated fetch                                       2.64(5.30+0.69)        2.59(5.16+0.65) -1.9%
5310.6: pack to file (bitmap)                                 58.75(57.56+6.30)      58.29(57.61+5.73) -0.8%
5310.7: rev-list (commits)                                    1.45(1.18+0.26)        1.46(1.22+0.24) +0.7%
5310.8: rev-list (objects)                                    15.35(14.22+1.13)      15.30(14.23+1.07) -0.3%
5310.9: rev-list with tag negated via --not --all (objects)   22.49(20.93+1.56)      0.11(0.09+0.01) -99.5%
5310.10: rev-list with negative tag (objects)                 0.61(0.44+0.16)        0.51(0.35+0.16) -16.4%
5310.11: rev-list count with blob:none                        12.15(11.19+0.96)      12.18(11.19+0.99) +0.2%
5310.12: rev-list count with blob:limit=1k                    17.77(15.71+2.06)      17.75(15.63+2.12) -0.1%
5310.13: rev-list count with tree:0                           1.69(1.31+0.38)        1.68(1.28+0.39) -0.6%
5310.14: simulated partial clone                              20.14(19.15+0.98)      19.98(18.93+1.05) -0.8%
5310.16: clone (partial bitmap)                               12.78(13.89+1.07)      12.72(13.99+1.01) -0.5%
5310.17: pack to file (partial bitmap)                        42.07(45.44+2.72)      41.44(44.66+2.80) -1.5%
5310.18: rev-list with tree filter (partial bitmap)           0.44(0.29+0.15)        0.46(0.32+0.14) +4.5%

While most benchmarks are probably in the range of noise, the newly
added 5310.9 and 5310.10 benchmarks consistenly perform better.

Signed-off-by: Patrick Steinhardt <ps@pks.im>.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: cacc5c0235589d2a1e5fda48d113bd529c7fd5f6
  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. CODE_OF_CONDUCT.md
  80. color.c
  81. color.h
  82. column.c
  83. column.h
  84. combine-diff.c
  85. command-list.txt
  86. commit-graph.c
  87. commit-graph.h
  88. commit-reach.c
  89. commit-reach.h
  90. commit-slab-decl.h
  91. commit-slab-impl.h
  92. commit-slab.h
  93. commit.c
  94. commit.h
  95. common-main.c
  96. config.c
  97. config.h
  98. config.mak.dev
  99. config.mak.in
  100. config.mak.uname
  101. configure.ac
  102. connect.c
  103. connect.h
  104. connected.c
  105. connected.h
  106. convert.c
  107. convert.h
  108. copy.c
  109. COPYING
  110. credential.c
  111. credential.h
  112. csum-file.c
  113. csum-file.h
  114. ctype.c
  115. daemon.c
  116. date.c
  117. decorate.c
  118. decorate.h
  119. delta-islands.c
  120. delta-islands.h
  121. delta.h
  122. detect-compiler
  123. diff-delta.c
  124. diff-lib.c
  125. diff-no-index.c
  126. diff.c
  127. diff.h
  128. diffcore-break.c
  129. diffcore-delta.c
  130. diffcore-order.c
  131. diffcore-pickaxe.c
  132. diffcore-rename.c
  133. diffcore.h
  134. dir-iterator.c
  135. dir-iterator.h
  136. dir.c
  137. dir.h
  138. editor.c
  139. entry.c
  140. environment.c
  141. exec-cmd.c
  142. exec-cmd.h
  143. fetch-negotiator.c
  144. fetch-negotiator.h
  145. fetch-pack.c
  146. fetch-pack.h
  147. fmt-merge-msg.c
  148. fmt-merge-msg.h
  149. fsck.c
  150. fsck.h
  151. fsmonitor.c
  152. fsmonitor.h
  153. fuzz-commit-graph.c
  154. fuzz-pack-headers.c
  155. fuzz-pack-idx.c
  156. generate-cmdlist.sh
  157. generate-configlist.sh
  158. gettext.c
  159. gettext.h
  160. git-add--interactive.perl
  161. git-archimport.perl
  162. git-bisect.sh
  163. git-compat-util.h
  164. git-cvsexportcommit.perl
  165. git-cvsimport.perl
  166. git-cvsserver.perl
  167. git-difftool--helper.sh
  168. git-filter-branch.sh
  169. git-instaweb.sh
  170. git-merge-octopus.sh
  171. git-merge-one-file.sh
  172. git-merge-resolve.sh
  173. git-mergetool--lib.sh
  174. git-mergetool.sh
  175. git-p4.py
  176. git-quiltimport.sh
  177. git-rebase--preserve-merges.sh
  178. git-request-pull.sh
  179. git-send-email.perl
  180. git-sh-i18n.sh
  181. git-sh-setup.sh
  182. git-submodule.sh
  183. git-svn.perl
  184. GIT-VERSION-GEN
  185. git-web--browse.sh
  186. git.c
  187. git.rc
  188. gpg-interface.c
  189. gpg-interface.h
  190. graph.c
  191. graph.h
  192. grep.c
  193. grep.h
  194. hash.h
  195. hashmap.c
  196. hashmap.h
  197. help.c
  198. help.h
  199. hex.c
  200. http-backend.c
  201. http-fetch.c
  202. http-push.c
  203. http-walker.c
  204. http.c
  205. http.h
  206. ident.c
  207. imap-send.c
  208. INSTALL
  209. iterator.h
  210. json-writer.c
  211. json-writer.h
  212. khash.h
  213. kwset.c
  214. kwset.h
  215. levenshtein.c
  216. levenshtein.h
  217. LGPL-2.1
  218. line-log.c
  219. line-log.h
  220. line-range.c
  221. line-range.h
  222. linear-assignment.c
  223. linear-assignment.h
  224. list-objects-filter-options.c
  225. list-objects-filter-options.h
  226. list-objects-filter.c
  227. list-objects-filter.h
  228. list-objects.c
  229. list-objects.h
  230. list.h
  231. ll-merge.c
  232. ll-merge.h
  233. lockfile.c
  234. lockfile.h
  235. log-tree.c
  236. log-tree.h
  237. ls-refs.c
  238. ls-refs.h
  239. mailinfo.c
  240. mailinfo.h
  241. mailmap.c
  242. mailmap.h
  243. Makefile
  244. match-trees.c
  245. mem-pool.c
  246. mem-pool.h
  247. merge-blobs.c
  248. merge-blobs.h
  249. merge-ort-wrappers.c
  250. merge-ort-wrappers.h
  251. merge-ort.c
  252. merge-ort.h
  253. merge-recursive.c
  254. merge-recursive.h
  255. merge.c
  256. mergesort.c
  257. mergesort.h
  258. midx.c
  259. midx.h
  260. name-hash.c
  261. notes-cache.c
  262. notes-cache.h
  263. notes-merge.c
  264. notes-merge.h
  265. notes-utils.c
  266. notes-utils.h
  267. notes.c
  268. notes.h
  269. object-store.h
  270. object.c
  271. object.h
  272. oid-array.c
  273. oid-array.h
  274. oidmap.c
  275. oidmap.h
  276. oidset.c
  277. oidset.h
  278. pack-bitmap-write.c
  279. pack-bitmap.c
  280. pack-bitmap.h
  281. pack-check.c
  282. pack-objects.c
  283. pack-objects.h
  284. pack-revindex.c
  285. pack-revindex.h
  286. pack-write.c
  287. pack.h
  288. packfile.c
  289. packfile.h
  290. pager.c
  291. parse-options-cb.c
  292. parse-options.c
  293. parse-options.h
  294. patch-delta.c
  295. patch-ids.c
  296. patch-ids.h
  297. path.c
  298. path.h
  299. pathspec.c
  300. pathspec.h
  301. pkt-line.c
  302. pkt-line.h
  303. preload-index.c
  304. pretty.c
  305. pretty.h
  306. prio-queue.c
  307. prio-queue.h
  308. progress.c
  309. progress.h
  310. promisor-remote.c
  311. promisor-remote.h
  312. prompt.c
  313. prompt.h
  314. protocol.c
  315. protocol.h
  316. prune-packed.c
  317. prune-packed.h
  318. quote.c
  319. quote.h
  320. range-diff.c
  321. range-diff.h
  322. reachable.c
  323. reachable.h
  324. read-cache.c
  325. README.md
  326. rebase-interactive.c
  327. rebase-interactive.h
  328. rebase.c
  329. rebase.h
  330. ref-filter.c
  331. ref-filter.h
  332. reflog-walk.c
  333. reflog-walk.h
  334. refs.c
  335. refs.h
  336. refspec.c
  337. refspec.h
  338. remote-curl.c
  339. remote.c
  340. remote.h
  341. replace-object.c
  342. replace-object.h
  343. repo-settings.c
  344. repository.c
  345. repository.h
  346. rerere.c
  347. rerere.h
  348. reset.c
  349. reset.h
  350. resolve-undo.c
  351. resolve-undo.h
  352. revision.c
  353. revision.h
  354. run-command.c
  355. run-command.h
  356. send-pack.c
  357. send-pack.h
  358. sequencer.c
  359. sequencer.h
  360. serve.c
  361. serve.h
  362. server-info.c
  363. setup.c
  364. sh-i18n--envsubst.c
  365. sha1-file.c
  366. sha1-lookup.c
  367. sha1-lookup.h
  368. sha1-name.c
  369. sha1dc_git.c
  370. sha1dc_git.h
  371. shallow.c
  372. shallow.h
  373. shell.c
  374. shortlog.h
  375. sideband.c
  376. sideband.h
  377. sigchain.c
  378. sigchain.h
  379. split-index.c
  380. split-index.h
  381. stable-qsort.c
  382. strbuf.c
  383. strbuf.h
  384. streaming.c
  385. streaming.h
  386. string-list.c
  387. string-list.h
  388. strmap.c
  389. strmap.h
  390. strvec.c
  391. strvec.h
  392. sub-process.c
  393. sub-process.h
  394. submodule-config.c
  395. submodule-config.h
  396. submodule.c
  397. submodule.h
  398. symlinks.c
  399. tag.c
  400. tag.h
  401. tar.h
  402. tempfile.c
  403. tempfile.h
  404. thread-utils.c
  405. thread-utils.h
  406. tmp-objdir.c
  407. tmp-objdir.h
  408. trace.c
  409. trace.h
  410. trace2.c
  411. trace2.h
  412. trailer.c
  413. trailer.h
  414. transport-helper.c
  415. transport-internal.h
  416. transport.c
  417. transport.h
  418. tree-diff.c
  419. tree-walk.c
  420. tree-walk.h
  421. tree.c
  422. tree.h
  423. unicode-width.h
  424. unimplemented.sh
  425. unix-socket.c
  426. unix-socket.h
  427. unpack-trees.c
  428. unpack-trees.h
  429. upload-pack.c
  430. upload-pack.h
  431. url.c
  432. url.h
  433. urlmatch.c
  434. urlmatch.h
  435. usage.c
  436. userdiff.c
  437. userdiff.h
  438. utf8.c
  439. utf8.h
  440. varint.c
  441. varint.h
  442. version.c
  443. version.h
  444. versioncmp.c
  445. walker.c
  446. walker.h
  447. wildmatch.c
  448. wildmatch.h
  449. worktree.c
  450. worktree.h
  451. wrap-for-bin.sh
  452. wrapper.c
  453. write-or-die.c
  454. ws.c
  455. wt-status.c
  456. wt-status.h
  457. xdiff-interface.c
  458. xdiff-interface.h
  459. 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