rev-list: make empty --stdin not an error

When we originally did the series that contains 7ba826290a
(revision: add rev_input_given flag, 2017-08-02) the intent
was that "git rev-list --stdin </dev/null" would similarly
become a successful noop. However, an attempt at the time to
do that did not work[1]. The problem is that rev_input_given
serves two roles:

 - it tells rev-list.c that it should not error out

 - it tells revision.c that it should not have the "default"
   ref kick (e.g., "HEAD" in "git log")

We want to trigger the former, but not the latter. This is
technically possible with a single flag, if we set the flag
only after revision.c's revs->def check. But this introduces
a rather subtle ordering dependency.

Instead, let's keep two flags: one to denote when we got
actual input (which triggers both roles) and one for when we
read stdin (which triggers only the first).

This does mean a caller interested in the first role has to
check both flags, but there's only one such caller. And any
future callers might want to make the distinction anyway
(e.g., if they care less about erroring out, and more about
whether revision.c soaked up our stdin).

In fact, we already keep such a flag internally in
revision.c for this purpose, so this is really just exposing
that to the caller (and the old function-local flag can go
away in favor of our new one).

[1] https://public-inbox.org/git/20170802223416.gwiezhbuxbdmbjzx@sigill.intra.peff.net/

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

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