CheckCommand returns true if the command arguments and environment match those when the GIT_ASKPASS command is invoked by git.
(args, env []string)
| 14 | // CheckCommand returns true if the command arguments and environment |
| 15 | // match those when the GIT_ASKPASS command is invoked by git. |
| 16 | func CheckCommand(args, env []string) bool { |
| 17 | if len(args) != 1 || (!strings.HasPrefix(args[0], "Username ") && !strings.HasPrefix(args[0], "Password ")) { |
| 18 | return false |
| 19 | } |
| 20 | for _, e := range env { |
| 21 | if strings.HasPrefix(e, "GIT_PREFIX=") { |
| 22 | return true |
| 23 | } |
| 24 | } |
| 25 | return false |
| 26 | } |
| 27 | |
| 28 | // ParseAskpass returns the user and host from a git askpass prompt. For |
| 29 | // example: "user1" and "https://github.com". Note that for HTTP |
no outgoing calls