trim whitespace from GIT_ASKPASS provided passwords

This commit is contained in:
rick olson 2017-09-22 10:32:06 -06:00
parent 7182aba593
commit f9f11aac8a
3 changed files with 4 additions and 2 deletions

@ -197,7 +197,7 @@ func (a *AskPassCredentialHelper) Fill(what Creds) (Creds, error) {
// store it in the creds instance that we will return to the caller.
creds := make(Creds)
creds["username"] = strings.TrimSpace(user.String())
creds["password"] = pass.String()
creds["password"] = strings.TrimSpace(pass.String())
return creds, nil
}

@ -25,5 +25,5 @@ func main() {
}
}
fmt.Print(answer)
fmt.Println(answer)
}

@ -25,6 +25,7 @@ begin_test "askpass: push with GIT_ASKPASS"
grep "filling with GIT_ASKPASS: lfs-askpass Username for \"$GITSERVER/$reponame\"" push.log
grep "filling with GIT_ASKPASS: lfs-askpass Password for \"$GITSERVER_USER/$reponame\"" push.log
grep "master -> master" push.log
)
end_test
@ -60,5 +61,6 @@ begin_test "askpass: push with core.askPass"
grep "filling with GIT_ASKPASS: lfs-askpass Username for \"$GITSERVER/$reponame\"" push.log
grep "filling with GIT_ASKPASS: lfs-askpass Password for \"$GITSERVER_USER/$reponame\"" push.log
grep "master -> master" push.log
)
end_test