commit: use generation number in remove_redundant()

The static remove_redundant() method is used to filter a list
of commits by removing those that are reachable from another
commit in the list. This is used to remove all possible merge-
bases except a maximal, mutually independent set.

To determine these commits are independent, we use a number of
paint_down_to_common() walks and use the PARENT1, PARENT2 flags
to determine reachability. Since we only care about reachability
and not the full set of merge-bases between 'one' and 'twos', we
can use the 'min_generation' parameter to short-circuit the walk.

When no commit-graph exists, there is no change in behavior.

For a copy of the Linux repository, we measured the following
performance improvements:

git merge-base v3.3 v4.5

Before: 234 ms
 After: 208 ms
 Rel %: -11%

git merge-base v4.3 v4.5

Before: 102 ms
 After:  83 ms
 Rel %: -19%

The experiments above were chosen to demonstrate that we are
improving the filtering of the merge-base set. In the first
example, more time is spent walking the history to find the
set of merge bases before the remove_redundant() call. The
starting commits are closer together in the second example,
therefore more time is spent in remove_redundant(). The relative
change in performance differs as expected.

Reported-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: 2928bb43e41c464afabb8d1d56ccc82595598e7d
  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. perl/
  14. po/
  15. ppc/
  16. refs/
  17. sha1dc/
  18. t/
  19. templates/
  20. vcs-svn/
  21. xdiff/
  22. .clang-format
  23. .gitattributes
  24. .gitignore
  25. .gitmodules
  26. .mailmap
  27. .travis.yml
  28. .tsan-suppressions
  29. abspath.c
  30. aclocal.m4
  31. advice.c
  32. advice.h
  33. alias.c
  34. alloc.c
  35. apply.c
  36. apply.h
  37. archive-tar.c
  38. archive-zip.c
  39. archive.c
  40. archive.h
  41. argv-array.c
  42. argv-array.h
  43. attr.c
  44. attr.h
  45. base85.c
  46. bisect.c
  47. bisect.h
  48. blame.c
  49. blame.h
  50. blob.c
  51. blob.h
  52. branch.c
  53. branch.h
  54. builtin.h
  55. bulk-checkin.c
  56. bulk-checkin.h
  57. bundle.c
  58. bundle.h
  59. cache-tree.c
  60. cache-tree.h
  61. cache.h
  62. check-builtins.sh
  63. check-racy.c
  64. check_bindir
  65. checkout.c
  66. checkout.h
  67. color.c
  68. color.h
  69. column.c
  70. column.h
  71. combine-diff.c
  72. command-list.txt
  73. commit-graph.c
  74. commit-graph.h
  75. commit-slab.h
  76. commit.c
  77. commit.h
  78. common-main.c
  79. config.c
  80. config.h
  81. config.mak.in
  82. config.mak.uname
  83. configure.ac
  84. connect.c
  85. connect.h
  86. connected.c
  87. connected.h
  88. convert.c
  89. convert.h
  90. copy.c
  91. COPYING
  92. credential-cache--daemon.c
  93. credential-cache.c
  94. credential-store.c
  95. credential.c
  96. credential.h
  97. csum-file.c
  98. csum-file.h
  99. ctype.c
  100. daemon.c
  101. date.c
  102. decorate.c
  103. decorate.h
  104. delta.h
  105. diff-delta.c
  106. diff-lib.c
  107. diff-no-index.c
  108. diff.c
  109. diff.h
  110. diffcore-break.c
  111. diffcore-delta.c
  112. diffcore-order.c
  113. diffcore-pickaxe.c
  114. diffcore-rename.c
  115. diffcore.h
  116. dir-iterator.c
  117. dir-iterator.h
  118. dir.c
  119. dir.h
  120. editor.c
  121. entry.c
  122. environment.c
  123. exec_cmd.c
  124. exec_cmd.h
  125. fast-import.c
  126. fetch-object.c
  127. fetch-object.h
  128. fetch-pack.c
  129. fetch-pack.h
  130. fmt-merge-msg.h
  131. fsck.c
  132. fsck.h
  133. fsmonitor.c
  134. fsmonitor.h
  135. generate-cmdlist.sh
  136. gettext.c
  137. gettext.h
  138. git-add--interactive.perl
  139. git-archimport.perl
  140. git-bisect.sh
  141. git-compat-util.h
  142. git-cvsexportcommit.perl
  143. git-cvsimport.perl
  144. git-cvsserver.perl
  145. git-difftool--helper.sh
  146. git-filter-branch.sh
  147. git-instaweb.sh
  148. git-merge-octopus.sh
  149. git-merge-one-file.sh
  150. git-merge-resolve.sh
  151. git-mergetool--lib.sh
  152. git-mergetool.sh
  153. git-p4.py
  154. git-parse-remote.sh
  155. git-quiltimport.sh
  156. git-rebase--am.sh
  157. git-rebase--interactive.sh
  158. git-rebase--merge.sh
  159. git-rebase.sh
  160. git-remote-testgit.sh
  161. git-request-pull.sh
  162. git-send-email.perl
  163. git-sh-i18n.sh
  164. git-sh-setup.sh
  165. git-stash.sh
  166. git-submodule.sh
  167. git-svn.perl
  168. GIT-VERSION-GEN
  169. git-web--browse.sh
  170. git.c
  171. git.rc
  172. gpg-interface.c
  173. gpg-interface.h
  174. graph.c
  175. graph.h
  176. grep.c
  177. grep.h
  178. hash.h
  179. hashmap.c
  180. hashmap.h
  181. help.c
  182. help.h
  183. hex.c
  184. http-backend.c
  185. http-fetch.c
  186. http-push.c
  187. http-walker.c
  188. http.c
  189. http.h
  190. ident.c
  191. imap-send.c
  192. INSTALL
  193. iterator.h
  194. khash.h
  195. kwset.c
  196. kwset.h
  197. levenshtein.c
  198. levenshtein.h
  199. LGPL-2.1
  200. line-log.c
  201. line-log.h
  202. line-range.c
  203. line-range.h
  204. list-objects-filter-options.c
  205. list-objects-filter-options.h
  206. list-objects-filter.c
  207. list-objects-filter.h
  208. list-objects.c
  209. list-objects.h
  210. list.h
  211. ll-merge.c
  212. ll-merge.h
  213. lockfile.c
  214. lockfile.h
  215. log-tree.c
  216. log-tree.h
  217. mailinfo.c
  218. mailinfo.h
  219. mailmap.c
  220. mailmap.h
  221. Makefile
  222. match-trees.c
  223. merge-blobs.c
  224. merge-blobs.h
  225. merge-recursive.c
  226. merge-recursive.h
  227. merge.c
  228. mergesort.c
  229. mergesort.h
  230. name-hash.c
  231. notes-cache.c
  232. notes-cache.h
  233. notes-merge.c
  234. notes-merge.h
  235. notes-utils.c
  236. notes-utils.h
  237. notes.c
  238. notes.h
  239. object.c
  240. object.h
  241. oidmap.c
  242. oidmap.h
  243. oidset.c
  244. oidset.h
  245. pack-bitmap-write.c
  246. pack-bitmap.c
  247. pack-bitmap.h
  248. pack-check.c
  249. pack-objects.c
  250. pack-objects.h
  251. pack-revindex.c
  252. pack-revindex.h
  253. pack-write.c
  254. pack.h
  255. packfile.c
  256. packfile.h
  257. pager.c
  258. parse-options-cb.c
  259. parse-options.c
  260. parse-options.h
  261. patch-delta.c
  262. patch-ids.c
  263. patch-ids.h
  264. path.c
  265. path.h
  266. pathspec.c
  267. pathspec.h
  268. pkt-line.c
  269. pkt-line.h
  270. preload-index.c
  271. pretty.c
  272. pretty.h
  273. prio-queue.c
  274. prio-queue.h
  275. progress.c
  276. progress.h
  277. prompt.c
  278. prompt.h
  279. protocol.c
  280. protocol.h
  281. quote.c
  282. quote.h
  283. reachable.c
  284. reachable.h
  285. read-cache.c
  286. README.md
  287. ref-filter.c
  288. ref-filter.h
  289. reflog-walk.c
  290. reflog-walk.h
  291. refs.c
  292. refs.h
  293. remote-curl.c
  294. remote-testsvn.c
  295. remote.c
  296. remote.h
  297. replace_object.c
  298. repository.c
  299. repository.h
  300. rerere.c
  301. rerere.h
  302. resolve-undo.c
  303. resolve-undo.h
  304. revision.c
  305. revision.h
  306. run-command.c
  307. run-command.h
  308. send-pack.c
  309. send-pack.h
  310. sequencer.c
  311. sequencer.h
  312. server-info.c
  313. setup.c
  314. sh-i18n--envsubst.c
  315. sha1-array.c
  316. sha1-array.h
  317. sha1-lookup.c
  318. sha1-lookup.h
  319. sha1_file.c
  320. sha1_name.c
  321. sha1dc_git.c
  322. sha1dc_git.h
  323. shallow.c
  324. shell.c
  325. shortlog.h
  326. show-index.c
  327. sideband.c
  328. sideband.h
  329. sigchain.c
  330. sigchain.h
  331. split-index.c
  332. split-index.h
  333. strbuf.c
  334. strbuf.h
  335. streaming.c
  336. streaming.h
  337. string-list.c
  338. string-list.h
  339. sub-process.c
  340. sub-process.h
  341. submodule-config.c
  342. submodule-config.h
  343. submodule.c
  344. submodule.h
  345. symlinks.c
  346. tag.c
  347. tag.h
  348. tar.h
  349. tempfile.c
  350. tempfile.h
  351. thread-utils.c
  352. thread-utils.h
  353. tmp-objdir.c
  354. tmp-objdir.h
  355. trace.c
  356. trace.h
  357. trailer.c
  358. trailer.h
  359. transport-helper.c
  360. transport-internal.h
  361. transport.c
  362. transport.h
  363. tree-diff.c
  364. tree-walk.c
  365. tree-walk.h
  366. tree.c
  367. tree.h
  368. unicode_width.h
  369. unimplemented.sh
  370. unix-socket.c
  371. unix-socket.h
  372. unpack-trees.c
  373. unpack-trees.h
  374. upload-pack.c
  375. url.c
  376. url.h
  377. urlmatch.c
  378. urlmatch.h
  379. usage.c
  380. userdiff.c
  381. userdiff.h
  382. utf8.c
  383. utf8.h
  384. varint.c
  385. varint.h
  386. version.c
  387. version.h
  388. versioncmp.c
  389. walker.c
  390. walker.h
  391. wildmatch.c
  392. wildmatch.h
  393. worktree.c
  394. worktree.h
  395. wrap-for-bin.sh
  396. wrapper.c
  397. write_or_die.c
  398. ws.c
  399. wt-status.c
  400. wt-status.h
  401. xdiff-interface.c
  402. xdiff-interface.h
  403. zlib.c
README.md

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-.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://public-inbox.org/git/, http://marc.info/?l=git and other archival sites.

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