mirror of
https://github.com/git/git.git
synced 2026-02-13 11:21:10 +00:00
wincred: accept CRLF on stdin to simplify console usage
The windows credential helper currently only accepts LF on stdin, but bash and cmd.exe both send CRLF. This prevents interactive use in the console. Change the stdin parser to optionally accept CRLF. Signed-off-by: Karsten Blees <blees@dcon.de>
This commit is contained in:
committed by
Pat Thoyts
parent
ca6dffac16
commit
117343979f
@@ -284,10 +284,13 @@ static void read_credential(void)
|
||||
|
||||
while (fgets(buf, sizeof(buf), stdin)) {
|
||||
char *v;
|
||||
int len = strlen(buf);
|
||||
/* strip trailing CR / LF */
|
||||
while (len && strchr("\r\n", buf[len - 1]))
|
||||
buf[--len] = 0;
|
||||
|
||||
if (!strcmp(buf, "\n"))
|
||||
if (!*buf)
|
||||
break;
|
||||
buf[strlen(buf)-1] = '\0';
|
||||
|
||||
v = strchr(buf, '=');
|
||||
if (!v)
|
||||
|
||||
Reference in New Issue
Block a user