mingw: safe-guard a bit more against getenv() problems

Running up to v2.21.0, we fixed two bugs that were made prominent by the
Windows-specific change to retain copies of only the 30 latest getenv()
calls' returned strings, invalidating any copies of previous getenv()
calls' return values.

While this really shines a light onto bugs of the form where we hold
onto getenv()'s return values without copying them, it is also a real
problem for users.

And even if Jeff King's patches merged via 773e408881 (Merge branch
'jk/save-getenv-result', 2019-01-29) provide further work on that front,
we are far from done. Just one example: on Windows, we unset environment
variables when spawning new processes, which potentially invalidates
strings that were previously obtained via getenv(), and therefore we
have to duplicate environment values that are somehow involved in
spawning new processes (e.g. GIT_MAN_VIEWER in show_man_page()).

We do not have a chance to investigate, let address, all of those issues
in time for v2.21.0, so let's at least help Windows users by increasing
the number of getenv() calls' return values that are kept valid. The
number 64 was determined by looking at the average number of getenv()
calls per process in the entire test suite run on Windows (which is
around 40) and then adding a bit for good measure. And it is a power of
two (which would have hit yesterday's theme perfectly).

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

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