diff options
author | Nikita Leonov <nykyta.leonov@gmail.com> | 2020-10-03 13:29:12 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-10-03 10:41:03 -0700 |
commit | 356c473295097f4aeaacc1a2dcd70271b7080788 (patch) | |
tree | ae5c058b84eda697e616ddeffededf90419fd5d7 /t/t1514-rev-parse-push.sh | |
parent | Seventeenth batch (diff) | |
download | tgif-356c473295097f4aeaacc1a2dcd70271b7080788.tar.xz |
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>
Diffstat (limited to 't/t1514-rev-parse-push.sh')
0 files changed, 0 insertions, 0 deletions