Skip to content

Commit 1b4b537

Browse files
nyckyta-tmpdscho
authored andcommitted
credential.c: fix credential reading with regards to CR/LF
This fix makes using Git credentials more friendly to Windows users. In previous version it was unable to finish input correctly without configuration changes (tested in PowerShell, CMD, Cygwin). We know credential filling should be finished by empty input, but the current implementation does not take into account CR/LF ending, and hence instead of the empty string we get '\r', which is interpreted as an incorrect string. So this commit changes default reading function to a more Windows compatible reading function. Signed-off-by: Nikita Leonov <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 19e2bd3 commit 1b4b537

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

credential.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ int credential_read(struct credential *c, FILE *fp)
146146
{
147147
struct strbuf line = STRBUF_INIT;
148148

149-
while (strbuf_getline_lf(&line, fp) != EOF) {
149+
while (strbuf_getline(&line, fp) != EOF) {
150150
char *key = line.buf;
151151
char *value = strchr(key, '=');
152152

0 commit comments

Comments
 (0)