Skip to content

Commit 5d25f5c

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 289e7d0 commit 5d25f5c

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
@@ -202,7 +202,7 @@ int credential_read(struct credential *c, FILE *fp)
202202
{
203203
struct strbuf line = STRBUF_INIT;
204204

205-
while (strbuf_getline_lf(&line, fp) != EOF) {
205+
while (strbuf_getline(&line, fp) != EOF) {
206206
char *key = line.buf;
207207
char *value = strchr(key, '=');
208208

0 commit comments

Comments
 (0)