commit-slab: add a function to deep free entries on the slab

clear_##slabname() frees only the memory allocated for a commit slab
itself, but entries in the commit slab might own additional memory
outside the slab that should be freed as well.  We already have (at
least) one such commit slab, and this patch series is about to add one
more.

To free all additional memory owned by entries on the commit slab the
user of such a slab could iterate over all commits it knows about,
peek whether there is a valid entry associated with each commit, and
free the additional memory, if any.  Or it could rely on intimate
knowledge about the internals of the commit slab implementation, and
could itself iterate directly through all entries in the slab, and
free the additional memory.  Or it could just leak the additional
memory...

Introduce deep_clear_##slabname() to allow releasing memory owned by
commit slab entries by invoking the 'void free_fn(elemtype *ptr)'
function specified as parameter for each entry in the slab.

Use it in get_shallow_commits() in 'shallow.c' to replace an
open-coded iteration over a commit slab's entries.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 files changed
tree: 30f3bc9b9aa316db57a1ae1e723469ce0083362b
  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. argv-array.c
  52. argv-array.h
  53. attr.c
  54. attr.h
  55. azure-pipelines.yml
  56. banned.h
  57. base85.c
  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.c
  72. bundle.h
  73. cache-tree.c
  74. cache-tree.h
  75. cache.h
  76. chdir-notify.c
  77. chdir-notify.h
  78. check-builtins.sh
  79. check_bindir
  80. checkout.c
  81. checkout.h
  82. CODE_OF_CONDUCT.md
  83. color.c
  84. color.h
  85. column.c
  86. column.h
  87. combine-diff.c
  88. command-list.txt
  89. commit-graph.c
  90. commit-graph.h
  91. commit-reach.c
  92. commit-reach.h
  93. commit-slab-decl.h
  94. commit-slab-impl.h
  95. commit-slab.h
  96. commit.c
  97. commit.h
  98. common-main.c
  99. config.c
  100. config.h
  101. config.mak.dev
  102. config.mak.in
  103. config.mak.uname
  104. configure.ac
  105. connect.c
  106. connect.h
  107. connected.c
  108. connected.h
  109. convert.c
  110. convert.h
  111. copy.c
  112. COPYING
  113. credential-cache--daemon.c
  114. credential-cache.c
  115. credential-store.c
  116. credential.c
  117. credential.h
  118. csum-file.c
  119. csum-file.h
  120. ctype.c
  121. daemon.c
  122. date.c
  123. decorate.c
  124. decorate.h
  125. delta-islands.c
  126. delta-islands.h
  127. delta.h
  128. detect-compiler
  129. diff-delta.c
  130. diff-lib.c
  131. diff-no-index.c
  132. diff.c
  133. diff.h
  134. diffcore-break.c
  135. diffcore-delta.c
  136. diffcore-order.c
  137. diffcore-pickaxe.c
  138. diffcore-rename.c
  139. diffcore.h
  140. dir-iterator.c
  141. dir-iterator.h
  142. dir.c
  143. dir.h
  144. editor.c
  145. entry.c
  146. environment.c
  147. exec-cmd.c
  148. exec-cmd.h
  149. fast-import.c
  150. fetch-negotiator.c
  151. fetch-negotiator.h
  152. fetch-pack.c
  153. fetch-pack.h
  154. fmt-merge-msg.h
  155. fsck.c
  156. fsck.h
  157. fsmonitor.c
  158. fsmonitor.h
  159. fuzz-commit-graph.c
  160. fuzz-pack-headers.c
  161. fuzz-pack-idx.c
  162. generate-cmdlist.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-parse-remote.sh
  182. git-quiltimport.sh
  183. git-rebase--preserve-merges.sh
  184. git-request-pull.sh
  185. git-send-email.perl
  186. git-sh-i18n.sh
  187. git-sh-setup.sh
  188. git-submodule.sh
  189. git-svn.perl
  190. GIT-VERSION-GEN
  191. git-web--browse.sh
  192. git.c
  193. git.rc
  194. gpg-interface.c
  195. gpg-interface.h
  196. graph.c
  197. graph.h
  198. grep.c
  199. grep.h
  200. hash.h
  201. hashmap.c
  202. hashmap.h
  203. help.c
  204. help.h
  205. hex.c
  206. http-backend.c
  207. http-fetch.c
  208. http-push.c
  209. http-walker.c
  210. http.c
  211. http.h
  212. ident.c
  213. imap-send.c
  214. INSTALL
  215. interdiff.c
  216. interdiff.h
  217. iterator.h
  218. json-writer.c
  219. json-writer.h
  220. khash.h
  221. kwset.c
  222. kwset.h
  223. levenshtein.c
  224. levenshtein.h
  225. LGPL-2.1
  226. line-log.c
  227. line-log.h
  228. line-range.c
  229. line-range.h
  230. linear-assignment.c
  231. linear-assignment.h
  232. list-objects-filter-options.c
  233. list-objects-filter-options.h
  234. list-objects-filter.c
  235. list-objects-filter.h
  236. list-objects.c
  237. list-objects.h
  238. list.h
  239. ll-merge.c
  240. ll-merge.h
  241. lockfile.c
  242. lockfile.h
  243. log-tree.c
  244. log-tree.h
  245. ls-refs.c
  246. ls-refs.h
  247. mailinfo.c
  248. mailinfo.h
  249. mailmap.c
  250. mailmap.h
  251. Makefile
  252. match-trees.c
  253. mem-pool.c
  254. mem-pool.h
  255. merge-blobs.c
  256. merge-blobs.h
  257. merge-recursive.c
  258. merge-recursive.h
  259. merge.c
  260. mergesort.c
  261. mergesort.h
  262. midx.c
  263. midx.h
  264. name-hash.c
  265. notes-cache.c
  266. notes-cache.h
  267. notes-merge.c
  268. notes-merge.h
  269. notes-utils.c
  270. notes-utils.h
  271. notes.c
  272. notes.h
  273. object-store.h
  274. object.c
  275. object.h
  276. oidmap.c
  277. oidmap.h
  278. oidset.c
  279. oidset.h
  280. pack-bitmap-write.c
  281. pack-bitmap.c
  282. pack-bitmap.h
  283. pack-check.c
  284. pack-objects.c
  285. pack-objects.h
  286. pack-revindex.c
  287. pack-revindex.h
  288. pack-write.c
  289. pack.h
  290. packfile.c
  291. packfile.h
  292. pager.c
  293. parse-options-cb.c
  294. parse-options.c
  295. parse-options.h
  296. patch-delta.c
  297. patch-ids.c
  298. patch-ids.h
  299. path.c
  300. path.h
  301. pathspec.c
  302. pathspec.h
  303. pkt-line.c
  304. pkt-line.h
  305. preload-index.c
  306. pretty.c
  307. pretty.h
  308. prio-queue.c
  309. prio-queue.h
  310. progress.c
  311. progress.h
  312. promisor-remote.c
  313. promisor-remote.h
  314. prompt.c
  315. prompt.h
  316. protocol.c
  317. protocol.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-testsvn.c
  340. remote.c
  341. remote.h
  342. replace-object.c
  343. replace-object.h
  344. repo-settings.c
  345. repository.c
  346. repository.h
  347. rerere.c
  348. rerere.h
  349. resolve-undo.c
  350. resolve-undo.h
  351. revision.c
  352. revision.h
  353. run-command.c
  354. run-command.h
  355. send-pack.c
  356. send-pack.h
  357. sequencer.c
  358. sequencer.h
  359. serve.c
  360. serve.h
  361. server-info.c
  362. setup.c
  363. sh-i18n--envsubst.c
  364. sha1-array.c
  365. sha1-array.h
  366. sha1-file.c
  367. sha1-lookup.c
  368. sha1-lookup.h
  369. sha1-name.c
  370. sha1dc_git.c
  371. sha1dc_git.h
  372. shallow.c
  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. sub-process.c
  389. sub-process.h
  390. submodule-config.c
  391. submodule-config.h
  392. submodule.c
  393. submodule.h
  394. symlinks.c
  395. tag.c
  396. tag.h
  397. tar.h
  398. tempfile.c
  399. tempfile.h
  400. thread-utils.c
  401. thread-utils.h
  402. tmp-objdir.c
  403. tmp-objdir.h
  404. trace.c
  405. trace.h
  406. trace2.c
  407. trace2.h
  408. trailer.c
  409. trailer.h
  410. transport-helper.c
  411. transport-internal.h
  412. transport.c
  413. transport.h
  414. tree-diff.c
  415. tree-walk.c
  416. tree-walk.h
  417. tree.c
  418. tree.h
  419. unicode-width.h
  420. unimplemented.sh
  421. unix-socket.c
  422. unix-socket.h
  423. unpack-trees.c
  424. unpack-trees.h
  425. upload-pack.c
  426. upload-pack.h
  427. url.c
  428. url.h
  429. urlmatch.c
  430. urlmatch.h
  431. usage.c
  432. userdiff.c
  433. userdiff.h
  434. utf8.c
  435. utf8.h
  436. varint.c
  437. varint.h
  438. version.c
  439. version.h
  440. versioncmp.c
  441. walker.c
  442. walker.h
  443. wildmatch.c
  444. wildmatch.h
  445. worktree.c
  446. worktree.h
  447. wrap-for-bin.sh
  448. wrapper.c
  449. write-or-die.c
  450. ws.c
  451. wt-status.c
  452. wt-status.h
  453. xdiff-interface.c
  454. xdiff-interface.h
  455. 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