pager: properly log pager exit code when signalled

When git invokes a pager that exits with non-zero the common case is
that we'll already return the correct SIGPIPE failure from git itself,
but the exit code logged in trace2 has always been incorrectly
reported[1]. Fix that and log the correct exit code in the logs.

Since this gives us something to test outside of our recently-added
tests needing a !MINGW prerequisite, let's refactor the test to run on
MINGW and actually check for SIGPIPE outside of MINGW.

The wait_or_whine() is only called with a true "in_signal" from from
finish_command_in_signal(), which in turn is only used in pager.c.

The "in_signal && !WIFEXITED(status)" case is not covered by
tests. Let's log the default -1 in that case for good measure.

1. The incorrect logging of the exit code in was seemingly copy/pasted
   into finish_command_in_signal() in ee4512ed481 (trace2: create new
   combined trace facility, 2019-02-22)

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