summaryrefslogtreecommitdiff
path: root/contrib/credential
diff options
context:
space:
mode:
authorKarsten Blees <blees@dcon.de>2013-01-09 11:49:26 (GMT)
committerErik Faye-Lund <kusmabite@gmail.com>2013-02-26 16:42:24 (GMT)
commit3b12f46ab382b280effa15a925b6195abaebf0a3 (patch)
tree8e6ee876a57d00c346f4ef3ec87dc07b3434682b /contrib/credential
parent4dac0679feaebbf6545daec14480cf6b94cb74ed (diff)
downloadgit-3b12f46ab382b280effa15a925b6195abaebf0a3.zip
git-3b12f46ab382b280effa15a925b6195abaebf0a3.tar.gz
git-3b12f46ab382b280effa15a925b6195abaebf0a3.tar.bz2
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> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Diffstat (limited to 'contrib/credential')
-rw-r--r--contrib/credential/wincred/git-credential-wincred.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index cbaec5f..94d7140 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -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)