credential: treat CR/LF as line endings in the credential protocol

This fix makes using Git credentials more friendly to Windows users: it
allows a credential helper to communicate using CR/LF line endings ("DOS
line endings" commonly found on Windows) instead of LF-only line endings
("Unix line endings").

Note that this changes the behavior a bit: if a credential helper
produces, say, a password with a trailing Carriage Return character,
that will now be culled even when the rest of the lines end only in Line
Feed characters, indicating that the Carriage Return was not meant to be
part of the line ending.

In practice, it seems _very_ unlikely that something like this happens.
Passwords usually need to consist of non-control characters, URLs need
to have special characters URL-encoded, and user names, well, are names.

However, it _does_ help on Windows, where CR/LF line endings are common:
as unrecognized commands are simply ignored by the credential machinery,
even a command like `quit\r` (which is clearly intended to abort) would
simply be ignored (silently) by Git.

So let's change the credential machinery to accept both CR/LF and LF
line endings.

While we do this for the credential helper protocol, we do _not_ adjust
`git credential-cache--daemon` (which won't work on Windows, anyway,
because it requires Unix sockets) nor `git credential-store` (which
writes the file `~/.git-credentials` which we consider an implementation
detail that should be opaque to the user, read: we do expect users _not_
to edit this file manually).

Signed-off-by: Nikita Leonov <nykyta.leonov@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 file changed
tree: ae5c058b84eda697e616ddeffededf90419fd5d7
  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. ewah/
  130. exec-cmd.c
  131. exec-cmd.h
  132. fetch-negotiator.c
  133. fetch-negotiator.h
  134. fetch-pack.c
  135. fetch-pack.h
  136. fmt-merge-msg.c
  137. fmt-merge-msg.h
  138. fsck.c
  139. fsck.h
  140. fsmonitor.c
  141. fsmonitor.h
  142. fuzz-commit-graph.c
  143. fuzz-pack-headers.c
  144. fuzz-pack-idx.c
  145. generate-cmdlist.sh
  146. generate-configlist.sh
  147. gettext.c
  148. gettext.h
  149. git-add--interactive.perl
  150. git-archimport.perl
  151. git-bisect.sh
  152. git-compat-util.h
  153. git-cvsexportcommit.perl
  154. git-cvsimport.perl
  155. git-cvsserver.perl
  156. git-difftool--helper.sh
  157. git-filter-branch.sh
  158. git-gui/
  159. git-instaweb.sh
  160. git-merge-octopus.sh
  161. git-merge-one-file.sh
  162. git-merge-resolve.sh
  163. git-mergetool--lib.sh
  164. git-mergetool.sh
  165. git-p4.py
  166. git-parse-remote.sh
  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.h
  187. hashmap.c
  188. hashmap.h
  189. help.c
  190. help.h
  191. hex.c
  192. http-backend.c
  193. http-fetch.c
  194. http-push.c
  195. http-walker.c
  196. http.c
  197. http.h
  198. ident.c
  199. imap-send.c
  200. iterator.h
  201. json-writer.c
  202. json-writer.h
  203. khash.h
  204. kwset.c
  205. kwset.h
  206. levenshtein.c
  207. levenshtein.h
  208. line-log.c
  209. line-log.h
  210. line-range.c
  211. line-range.h
  212. linear-assignment.c
  213. linear-assignment.h
  214. list-objects-filter-options.c
  215. list-objects-filter-options.h
  216. list-objects-filter.c
  217. list-objects-filter.h
  218. list-objects.c
  219. list-objects.h
  220. list.h
  221. ll-merge.c
  222. ll-merge.h
  223. lockfile.c
  224. lockfile.h
  225. log-tree.c
  226. log-tree.h
  227. ls-refs.c
  228. ls-refs.h
  229. mailinfo.c
  230. mailinfo.h
  231. mailmap.c
  232. mailmap.h
  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. mergetools/
  244. midx.c
  245. midx.h
  246. name-hash.c
  247. negotiator/
  248. notes-cache.c
  249. notes-cache.h
  250. notes-merge.c
  251. notes-merge.h
  252. notes-utils.c
  253. notes-utils.h
  254. notes.c
  255. notes.h
  256. object-store.h
  257. object.c
  258. object.h
  259. oid-array.c
  260. oid-array.h
  261. oidmap.c
  262. oidmap.h
  263. oidset.c
  264. oidset.h
  265. pack-bitmap-write.c
  266. pack-bitmap.c
  267. pack-bitmap.h
  268. pack-check.c
  269. pack-objects.c
  270. pack-objects.h
  271. pack-revindex.c
  272. pack-revindex.h
  273. pack-write.c
  274. pack.h
  275. packfile.c
  276. packfile.h
  277. pager.c
  278. parse-options-cb.c
  279. parse-options.c
  280. parse-options.h
  281. patch-delta.c
  282. patch-ids.c
  283. patch-ids.h
  284. path.c
  285. path.h
  286. pathspec.c
  287. pathspec.h
  288. perl/
  289. pkt-line.c
  290. pkt-line.h
  291. po/
  292. ppc/
  293. preload-index.c
  294. pretty.c
  295. pretty.h
  296. prio-queue.c
  297. prio-queue.h
  298. progress.c
  299. progress.h
  300. promisor-remote.c
  301. promisor-remote.h
  302. prompt.c
  303. prompt.h
  304. protocol.c
  305. protocol.h
  306. prune-packed.c
  307. prune-packed.h
  308. quote.c
  309. quote.h
  310. range-diff.c
  311. range-diff.h
  312. reachable.c
  313. reachable.h
  314. read-cache.c
  315. rebase-interactive.c
  316. rebase-interactive.h
  317. rebase.c
  318. rebase.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.c
  330. remote.h
  331. replace-object.c
  332. replace-object.h
  333. repo-settings.c
  334. repository.c
  335. repository.h
  336. rerere.c
  337. rerere.h
  338. reset.c
  339. reset.h
  340. resolve-undo.c
  341. resolve-undo.h
  342. revision.c
  343. revision.h
  344. run-command.c
  345. run-command.h
  346. send-pack.c
  347. send-pack.h
  348. sequencer.c
  349. sequencer.h
  350. serve.c
  351. serve.h
  352. server-info.c
  353. setup.c
  354. sh-i18n--envsubst.c
  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. shallow.h
  365. shell.c
  366. shortlog.h
  367. sideband.c
  368. sideband.h
  369. sigchain.c
  370. sigchain.h
  371. split-index.c
  372. split-index.h
  373. stable-qsort.c
  374. strbuf.c
  375. strbuf.h
  376. streaming.c
  377. streaming.h
  378. string-list.c
  379. string-list.h
  380. strvec.c
  381. strvec.h
  382. sub-process.c
  383. sub-process.h
  384. submodule-config.c
  385. submodule-config.h
  386. submodule.c
  387. submodule.h
  388. symlinks.c
  389. t/
  390. tag.c
  391. tag.h
  392. tar.h
  393. tempfile.c
  394. tempfile.h
  395. templates/
  396. thread-utils.c
  397. thread-utils.h
  398. tmp-objdir.c
  399. tmp-objdir.h
  400. trace.c
  401. trace.h
  402. trace2.c
  403. trace2.h
  404. trace2/
  405. trailer.c
  406. trailer.h
  407. transport-helper.c
  408. transport-internal.h
  409. transport.c
  410. transport.h
  411. tree-diff.c
  412. tree-walk.c
  413. tree-walk.h
  414. tree.c
  415. tree.h
  416. unicode-width.h
  417. unimplemented.sh
  418. unix-socket.c
  419. unix-socket.h
  420. unpack-trees.c
  421. unpack-trees.h
  422. upload-pack.c
  423. upload-pack.h
  424. url.c
  425. url.h
  426. urlmatch.c
  427. urlmatch.h
  428. usage.c
  429. userdiff.c
  430. userdiff.h
  431. utf8.c
  432. utf8.h
  433. varint.c
  434. varint.h
  435. vcs-svn/
  436. version.c
  437. version.h
  438. versioncmp.c
  439. walker.c
  440. walker.h
  441. wildmatch.c
  442. wildmatch.h
  443. worktree.c
  444. worktree.h
  445. wrap-for-bin.sh
  446. wrapper.c
  447. write-or-die.c
  448. ws.c
  449. wt-status.c
  450. wt-status.h
  451. xdiff-interface.c
  452. xdiff-interface.h
  453. xdiff/
  454. 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