reftable/basics: ban standard allocator functions

The reftable library uses pluggable allocators, which means that we
shouldn't ever use the standard allocator functions. But it is an easy
mistake to make to accidentally use e.g. free(3P) instead of the
reftable-specific `reftable_free()` function, and we do not have any
mechanism to detect this misuse right now.

Introduce a couple of macros that ban the standard allocators, similar
to how we do it in "banned.h".

Note that we do not ban the following two classes of functions:

  - Macros like `FREE_AND_NULL()` or `REALLOC_ARRAY()`. As those expand
    to code that contains already-banned functions we'd get a compiler
    error even without banning those macros explicitly.

  - Git-specific allocators like `xmalloc()` and friends. The primary
    reason is that there are simply too many of them, so we're rather
    aiming for best effort here. Furthermore, the eventual goal is to
    make them unavailable in the reftable library place by not pulling
    them in via "git-compat-utils.h" anymore.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: cc32582d5cbb63da215213b56980d03dc1c7c3c8
  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-lookup.c
  217. hash-lookup.h
  218. hash.h
  219. hashmap.c
  220. hashmap.h
  221. help.c
  222. help.h
  223. hex-ll.c
  224. hex-ll.h
  225. hex.c
  226. hex.h
  227. hook.c
  228. hook.h
  229. http-backend.c
  230. http-fetch.c
  231. http-push.c
  232. http-walker.c
  233. http.c
  234. http.h
  235. ident.c
  236. ident.h
  237. imap-send.c
  238. INSTALL
  239. iterator.h
  240. json-writer.c
  241. json-writer.h
  242. khash.h
  243. kwset.c
  244. kwset.h
  245. levenshtein.c
  246. levenshtein.h
  247. LGPL-2.1
  248. line-log.c
  249. line-log.h
  250. line-range.c
  251. line-range.h
  252. linear-assignment.c
  253. linear-assignment.h
  254. list-objects-filter-options.c
  255. list-objects-filter-options.h
  256. list-objects-filter.c
  257. list-objects-filter.h
  258. list-objects.c
  259. list-objects.h
  260. list.h
  261. lockfile.c
  262. lockfile.h
  263. log-tree.c
  264. log-tree.h
  265. loose.c
  266. loose.h
  267. ls-refs.c
  268. ls-refs.h
  269. mailinfo.c
  270. mailinfo.h
  271. mailmap.c
  272. mailmap.h
  273. Makefile
  274. match-trees.c
  275. match-trees.h
  276. mem-pool.c
  277. mem-pool.h
  278. merge-blobs.c
  279. merge-blobs.h
  280. merge-ll.c
  281. merge-ll.h
  282. merge-ort-wrappers.c
  283. merge-ort-wrappers.h
  284. merge-ort.c
  285. merge-ort.h
  286. merge-recursive.c
  287. merge-recursive.h
  288. merge.c
  289. merge.h
  290. mergesort.h
  291. midx-write.c
  292. midx.c
  293. midx.h
  294. name-hash.c
  295. name-hash.h
  296. notes-cache.c
  297. notes-cache.h
  298. notes-merge.c
  299. notes-merge.h
  300. notes-utils.c
  301. notes-utils.h
  302. notes.c
  303. notes.h
  304. object-file-convert.c
  305. object-file-convert.h
  306. object-file.c
  307. object-file.h
  308. object-name.c
  309. object-name.h
  310. object-store-ll.h
  311. object-store.h
  312. object.c
  313. object.h
  314. oid-array.c
  315. oid-array.h
  316. oidmap.c
  317. oidmap.h
  318. oidset.c
  319. oidset.h
  320. oidtree.c
  321. oidtree.h
  322. pack-bitmap-write.c
  323. pack-bitmap.c
  324. pack-bitmap.h
  325. pack-check.c
  326. pack-mtimes.c
  327. pack-mtimes.h
  328. pack-objects.c
  329. pack-objects.h
  330. pack-revindex.c
  331. pack-revindex.h
  332. pack-write.c
  333. pack.h
  334. packfile.c
  335. packfile.h
  336. pager.c
  337. pager.h
  338. parallel-checkout.c
  339. parallel-checkout.h
  340. parse-options-cb.c
  341. parse-options.c
  342. parse-options.h
  343. parse.c
  344. parse.h
  345. patch-delta.c
  346. patch-ids.c
  347. patch-ids.h
  348. path.c
  349. path.h
  350. pathspec.c
  351. pathspec.h
  352. pkt-line.c
  353. pkt-line.h
  354. preload-index.c
  355. preload-index.h
  356. pretty.c
  357. pretty.h
  358. prio-queue.c
  359. prio-queue.h
  360. progress.c
  361. progress.h
  362. promisor-remote.c
  363. promisor-remote.h
  364. prompt.c
  365. prompt.h
  366. protocol-caps.c
  367. protocol-caps.h
  368. protocol.c
  369. protocol.h
  370. prune-packed.c
  371. prune-packed.h
  372. pseudo-merge.c
  373. pseudo-merge.h
  374. quote.c
  375. quote.h
  376. range-diff.c
  377. range-diff.h
  378. reachable.c
  379. reachable.h
  380. read-cache-ll.h
  381. read-cache.c
  382. read-cache.h
  383. README.md
  384. rebase-interactive.c
  385. rebase-interactive.h
  386. rebase.c
  387. rebase.h
  388. ref-filter.c
  389. ref-filter.h
  390. reflog-walk.c
  391. reflog-walk.h
  392. reflog.c
  393. reflog.h
  394. refs.c
  395. refs.h
  396. refspec.c
  397. refspec.h
  398. remote-curl.c
  399. remote.c
  400. remote.h
  401. replace-object.c
  402. replace-object.h
  403. repo-settings.c
  404. repository.c
  405. repository.h
  406. rerere.c
  407. rerere.h
  408. reset.c
  409. reset.h
  410. resolve-undo.c
  411. resolve-undo.h
  412. revision.c
  413. revision.h
  414. run-command.c
  415. run-command.h
  416. sane-ctype.h
  417. scalar.c
  418. SECURITY.md
  419. send-pack.c
  420. send-pack.h
  421. sequencer.c
  422. sequencer.h
  423. serve.c
  424. serve.h
  425. server-info.c
  426. server-info.h
  427. setup.c
  428. setup.h
  429. sh-i18n--envsubst.c
  430. sha1dc_git.c
  431. sha1dc_git.h
  432. shallow.c
  433. shallow.h
  434. shared.mak
  435. shell.c
  436. shortlog.h
  437. sideband.c
  438. sideband.h
  439. sigchain.c
  440. sigchain.h
  441. simple-ipc.h
  442. sparse-index.c
  443. sparse-index.h
  444. split-index.c
  445. split-index.h
  446. stable-qsort.c
  447. statinfo.c
  448. statinfo.h
  449. strbuf.c
  450. strbuf.h
  451. streaming.c
  452. streaming.h
  453. string-list.c
  454. string-list.h
  455. strmap.c
  456. strmap.h
  457. strvec.c
  458. strvec.h
  459. sub-process.c
  460. sub-process.h
  461. submodule-config.c
  462. submodule-config.h
  463. submodule.c
  464. submodule.h
  465. symlinks.c
  466. symlinks.h
  467. tag.c
  468. tag.h
  469. tar.h
  470. tempfile.c
  471. tempfile.h
  472. thread-utils.c
  473. thread-utils.h
  474. tmp-objdir.c
  475. tmp-objdir.h
  476. trace.c
  477. trace.h
  478. trace2.c
  479. trace2.h
  480. trailer.c
  481. trailer.h
  482. transport-helper.c
  483. transport-internal.h
  484. transport.c
  485. transport.h
  486. tree-diff.c
  487. tree-walk.c
  488. tree-walk.h
  489. tree.c
  490. tree.h
  491. unicode-width.h
  492. unimplemented.sh
  493. unix-socket.c
  494. unix-socket.h
  495. unix-stream-server.c
  496. unix-stream-server.h
  497. unpack-trees.c
  498. unpack-trees.h
  499. upload-pack.c
  500. upload-pack.h
  501. url.c
  502. url.h
  503. urlmatch.c
  504. urlmatch.h
  505. usage.c
  506. userdiff.c
  507. userdiff.h
  508. utf8.c
  509. utf8.h
  510. varint.c
  511. varint.h
  512. version.c
  513. version.h
  514. versioncmp.c
  515. versioncmp.h
  516. walker.c
  517. walker.h
  518. wildmatch.c
  519. wildmatch.h
  520. worktree.c
  521. worktree.h
  522. wrap-for-bin.sh
  523. wrapper.c
  524. wrapper.h
  525. write-or-die.c
  526. write-or-die.h
  527. ws.c
  528. ws.h
  529. wt-status.c
  530. wt-status.h
  531. xdiff-interface.c
  532. 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 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