Get retrieves a `http.{url}.{key}` for the given key and urls, following the rules in https://git-scm.com/docs/git-config#Documentation/git-config.txt-httplturlgt. The value for `http.{key}` is returned as a fallback if no config keys are set for the given urls.
(prefix, rawurl, key string)
| 26 | // The value for `http.{key}` is returned as a fallback if no config keys are |
| 27 | // set for the given urls. |
| 28 | func (c *URLConfig) Get(prefix, rawurl, key string) (string, bool) { |
| 29 | if c == nil { |
| 30 | return "", false |
| 31 | } |
| 32 | |
| 33 | key = strings.ToLower(key) |
| 34 | prefix = strings.ToLower(prefix) |
| 35 | if v := c.getAll(prefix, rawurl, key); len(v) > 0 { |
| 36 | return v[len(v)-1], true |
| 37 | } |
| 38 | return c.git.Get(strings.Join([]string{prefix, key}, ".")) |
| 39 | } |
| 40 | |
| 41 | func (c *URLConfig) GetAll(prefix, rawurl, key string) []string { |
| 42 | if c == nil { |