Merge pull request #2607 from git-lfs/ask-pass-newlines

trim whitespace from GIT_ASKPASS provided passwords
This commit is contained in:
risk danger olson 2017-09-22 10:31:53 -07:00 committed by GitHub
commit 78300fb8bd
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