run-command.c: fix missing include under `NO_PTHREADS`

Git 2.41-rc0 fails to compile run-command.c with `NO_PTHREADS` defined,
i.e.

  $ make NO_PTHREADS=1 run-command.o

as `ALLOC_GROW()` macro is used in the `atexit()` emulation but the
macro definition is not available.

This bisects to 36bf195890 (alloc.h: move ALLOC_GROW() functions from
cache.h, 2023-02-24), which replaced includes of <cache.h> with
<alloc.h>, which is the new home of `ALLOC_GROW()` (and
`ALLOC_GROW_BY()`).

We can see that run-command.c is the only one that try to use these
macros without including <alloc.h>.

  $ git grep -l -e '[^_]ALLOC_GROW(' -e 'ALLOC_GROW_BY(' \*.c | sort >/tmp/1
  $ git grep -l 'alloc\.h' \*.c | sort >/tmp/2
  $ comm -23 /tmp/[12]
  compat/simple-ipc/ipc-unix-socket.c
  run-command.c

The "compat/" file only talks about the macro in the comment,
and is not broken.

We could fix this by conditionally including "alloc.h" when
`NO_PTHREADS` is defined.  But we have relatively few examples of
conditional includes throughout the tree[^1].

Instead, include "alloc.h" unconditionally in run-command.c to allow it
to successfully compile even when NO_PTHREADS is defined.

[^1]: With `git grep -E -A1 '#if(n)?def' -- **/*.c | grep '#include' -B1`.

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