| 1 | package credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/" |
| 7 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 8 | "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/" |
| 9 | "slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 11 | "syncscip-go gomod github.com/golang/go/src go1.25.0 sync/" |
| 12 | |
| 13 | "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/" |
| 14 | "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/" |
| 15 | "github.com/git-lfs/git-lfs/v3/subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/" |
| 16 | "github.com/git-lfs/git-lfs/v3/toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/" |
| 17 | "github.com/git-lfs/git-lfs/v3/trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/" |
| 18 | "github.com/rubyist/tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/" |
| 19 | ) |
| 20 | |
| 21 | // CredentialHelperWrapper is used to contain the encapsulate the information we need for credential handling during auth. |
| 22 | type CredentialHelperWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper# struct { |
| 23 | CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#CredentialHelper. CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper# |
| 24 | Inputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Input. Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds# |
| 25 | Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Url. *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL# |
| 26 | Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Creds. Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds# |
| 27 | } |
| 28 | |
| 29 | // CredentialHelper is an interface used by the lfsapi Client to interact with |
| 30 | // the 'git credential' command: https://git-scm.com/docs/gitcredentials |
| 31 | // Other implementations include ASKPASS support, and an in-memory cache. |
| 32 | type CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper# interface { |
| 33 | Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) |
| 34 | Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error |
| 35 | Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error |
| 36 | } |
| 37 | |
| 38 | func (credWrapper *CredentialHelperWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#) FillCredsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#FillCreds().() error { |
| 39 | creds, err := credWrapper.CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#CredentialHelper..Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(credWrapper.Inputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Input.) |
| 40 | if creds == nil || len(creds) < 1 { |
| 41 | errmsg := trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Git credentials for %s not found", credWrapper.Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Url.) |
| 42 | if err != nil { |
| 43 | errmsg = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s:\n%s", errmsg, err.Error()) |
| 44 | } else { |
| 45 | errmsg = fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s.", errmsg) |
| 46 | } |
| 47 | err = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(errmsg) |
| 48 | } |
| 49 | credWrapper.Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Creds. = creds |
| 50 | return err |
| 51 | } |
| 52 | |
| 53 | // Creds represents a set of key/value pairs that are passed to 'git credential' |
| 54 | // as input. |
| 55 | type Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds# map[string][]string |
| 56 | |
| 57 | func (c Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) IsMultistagescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#IsMultistage().() bool { |
| 58 | return slicesscip-go gomod github.com/golang/go/src go1.25.0 slices/.Containsscip-go gomod github.com/golang/go/src go1.25.0 slices/Contains().([]string{"1", "true"}, FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(c, "continue")) |
| 59 | } |
| 60 | |
| 61 | func (c Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(protectProtocol bool) (*bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#, error) { |
| 62 | buf := new(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#) |
| 63 | |
| 64 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte("capability[]=authtype\n")) |
| 65 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte("capability[]=state\n")) |
| 66 | for k, v := range c { |
| 67 | for _, item := range v { |
| 68 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(item, "\n") { |
| 69 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("credential value for %s contains newline: %q", k, item)) |
| 70 | } |
| 71 | if protectProtocol && stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(item, "\r") { |
| 72 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("credential value for %s contains carriage return: %q\nIf this is intended, set `credential.protectProtocol=false`", k, item)) |
| 73 | } |
| 74 | if stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Containsscip-go gomod github.com/golang/go/src go1.25.0 strings/Contains().(item, string(rune(0))) { |
| 75 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("credential value for %s contains null byte: %q", k, item)) |
| 76 | } |
| 77 | |
| 78 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte(k)) |
| 79 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte("=")) |
| 80 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte(item)) |
| 81 | buf.Writescip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Write().([]byte("\n")) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | return buf, nil |
| 86 | } |
| 87 | |
| 88 | type CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext# struct { |
| 89 | netrcCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#netrcCredHelper. *netrcCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/netrcCredentialHelper# |
| 90 | commandCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#commandCredHelper. *commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper# |
| 91 | askpassCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#askpassCredHelper. *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper# |
| 92 | cachingCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#cachingCredHelper. *credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher# |
| 93 | |
| 94 | urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig. *configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.URLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig# |
| 95 | wwwAuthHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#wwwAuthHeaders. []string |
| 96 | statescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#state. []string |
| 97 | } |
| 98 | |
| 99 | func NewCredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelperContext().(gitEnv configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#, osEnv configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Environmentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#) *CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext# { |
| 100 | c := &CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#{urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig.: configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.NewURLConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/NewURLConfig().(gitEnv)} |
| 101 | |
| 102 | c.netrcCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#netrcCredHelper. = newNetrcCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/newNetrcCredentialHelper().(osEnv) |
| 103 | |
| 104 | askpass, ok := osEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("GIT_ASKPASS") |
| 105 | if !ok { |
| 106 | askpass, ok = gitEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("core.askpass") |
| 107 | } |
| 108 | if !ok { |
| 109 | askpass, _ = osEnv.Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Get.("SSH_ASKPASS") |
| 110 | } |
| 111 | if len(askpass) > 0 { |
| 112 | askpassfile, err := toolsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/.TranslateCygwinPathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tools`/TranslateCygwinPath().(askpass) |
| 113 | if err != nil { |
| 114 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("Error reading askpass helper %q: %v", askpassfile, err) |
| 115 | } |
| 116 | if len(askpassfile) > 0 { |
| 117 | c.askpassCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#askpassCredHelper. = &AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#{ |
| 118 | Programscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Program.: askpassfile, |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | cacheCreds := gitEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("lfs.cachecredentials", true) |
| 124 | if cacheCreds { |
| 125 | c.cachingCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#cachingCredHelper. = NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().() |
| 126 | } |
| 127 | |
| 128 | c.commandCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#commandCredHelper. = &commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#{ |
| 129 | SkipPromptscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#SkipPrompt.: osEnv.Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/Environment#Bool.("GIT_TERMINAL_PROMPT", false), |
| 130 | } |
| 131 | |
| 132 | return c |
| 133 | } |
| 134 | |
| 135 | func (ctxt *CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#) SetWWWAuthHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#SetWWWAuthHeaders().(headers []string) { |
| 136 | ctxt.wwwAuthHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#wwwAuthHeaders. = headers |
| 137 | } |
| 138 | |
| 139 | func (ctxt *CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#) SetStateFieldsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#SetStateFields().(fields []string) { |
| 140 | ctxt.statescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#state. = fields |
| 141 | } |
| 142 | |
| 143 | // getCredentialHelper parses a 'credsConfig' from the git and OS environments, |
| 144 | // returning the appropriate CredentialHelper to authenticate requests with. |
| 145 | // |
| 146 | // It returns an error if any configuration was invalid, or otherwise |
| 147 | // un-useable. |
| 148 | func (ctxt *CredentialHelperContextscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#) GetCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#GetCredentialHelper().(helper CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#, u *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#) CredentialHelperWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper# { |
| 149 | rawurl := fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s://%s%s", u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme., u.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host., u.Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path.) |
| 150 | input := Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#{"protocol": []string{u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme.}, "host": []string{u.Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host.}} |
| 151 | if u.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. != nil && u.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Usernamescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Username().() != "" { |
| 152 | input["username"] = []string{u.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User..Usernamescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/Userinfo#Username().()} |
| 153 | } |
| 154 | if u.Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme. == "cert" || ctxt.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig..Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Bool().("credential", rawurl, "usehttppath", false) { |
| 155 | input["path"] = []string{stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/TrimPrefix().(u.Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path., "/")} |
| 156 | } |
| 157 | if len(ctxt.wwwAuthHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#wwwAuthHeaders.) != 0 && !ctxt.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig..Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Bool().("credential", rawurl, "skipwwwauth", false) { |
| 158 | input["wwwauth[]"] = ctxt.wwwAuthHeadersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#wwwAuthHeaders. |
| 159 | } |
| 160 | if len(ctxt.statescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#state.) != 0 { |
| 161 | input["state[]"] = ctxt.statescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#state. |
| 162 | } |
| 163 | |
| 164 | if helper != nil { |
| 165 | return CredentialHelperWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#{CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#CredentialHelper.: helper, Inputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Input.: input, Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Url.: u} |
| 166 | } |
| 167 | |
| 168 | helpers := make([]CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#, 0, 4) |
| 169 | if ctxt.netrcCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#netrcCredHelper. != nil { |
| 170 | helpers = append(helpers, ctxt.netrcCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#netrcCredHelper.) |
| 171 | } |
| 172 | if ctxt.cachingCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#cachingCredHelper. != nil { |
| 173 | helpers = append(helpers, ctxt.cachingCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#cachingCredHelper.) |
| 174 | } |
| 175 | if ctxt.askpassCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#askpassCredHelper. != nil { |
| 176 | helper, _ := ctxt.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig..Getscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Get().("credential", rawurl, "helper") |
| 177 | if len(helper) == 0 { |
| 178 | helpers = append(helpers, ctxt.askpassCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#askpassCredHelper.) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | ctxt.commandCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#commandCredHelper..protectProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#protectProtocol. = ctxt.urlConfigscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#urlConfig..Boolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/URLConfig#Bool().("credential", rawurl, "protectProtocol", true) |
| 183 | |
| 184 | return CredentialHelperWrapperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#{CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#CredentialHelper.: NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().(append(helpers, ctxt.commandCredHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperContext#commandCredHelper.)), Inputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Input.: input, Urlscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelperWrapper#Url.: u} |
| 185 | } |
| 186 | |
| 187 | // AskPassCredentialHelper implements the CredentialHelper type for GIT_ASKPASS |
| 188 | // and 'core.askpass' configuration values. |
| 189 | type AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper# struct { |
| 190 | // Program is the executable program's absolute or relative name. |
| 191 | Programscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Program. string |
| 192 | } |
| 193 | |
| 194 | type credValueTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueType# int |
| 195 | |
| 196 | const ( |
| 197 | credValueTypeUnknownscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypeUnknown. credValueTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueType# = iota |
| 198 | credValueTypeUsernamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypeUsername. |
| 199 | credValueTypePasswordscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypePassword. |
| 200 | ) |
| 201 | |
| 202 | // Fill implements fill by running the ASKPASS program and returning its output |
| 203 | // as a password encoded in the Creds type given the key "password". |
| 204 | // |
| 205 | // It accepts the password as coming from the program's stdout, as when invoked |
| 206 | // with the given arguments (see (*AskPassCredentialHelper).args() below)./ |
| 207 | // |
| 208 | // If there was an error running the command, it is returned instead of a set of |
| 209 | // filled credentials. |
| 210 | // |
| 211 | // The ASKPASS program is only queried if a credential was not already |
| 212 | // provided, i.e. through the git URL |
| 213 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Fill().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 214 | u := &urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#{ |
| 215 | Schemescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Scheme.: FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "protocol"), |
| 216 | Hostscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Host.: FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "host"), |
| 217 | Pathscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#Path.: FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "path"), |
| 218 | } |
| 219 | |
| 220 | creds := make(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) |
| 221 | |
| 222 | username, err := a.getValuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#getValue().(what, credValueTypeUsernamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypeUsername., u) |
| 223 | if err != nil { |
| 224 | return nil, err |
| 225 | } |
| 226 | creds["username"] = []string{username} |
| 227 | |
| 228 | if len(username) > 0 { |
| 229 | // If a non-empty username was given, add it to the URL via func |
| 230 | // 'net/url.User()'. |
| 231 | u.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#User. = urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.Userscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/User().(username) |
| 232 | } |
| 233 | |
| 234 | password, err := a.getValuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#getValue().(what, credValueTypePasswordscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypePassword., u) |
| 235 | if err != nil { |
| 236 | return nil, err |
| 237 | } |
| 238 | creds["password"] = []string{password} |
| 239 | |
| 240 | return creds, nil |
| 241 | } |
| 242 | |
| 243 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) getValuescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#getValue().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, valueType credValueTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueType#, u *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#) (string, error) { |
| 244 | var valueString string |
| 245 | |
| 246 | switch valueType { |
| 247 | case credValueTypeUsernamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypeUsername.: |
| 248 | valueString = "username" |
| 249 | case credValueTypePasswordscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypePassword.: |
| 250 | valueString = "password" |
| 251 | default: |
| 252 | return "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Invalid Credential type queried from AskPass")) |
| 253 | } |
| 254 | |
| 255 | // Return the existing credential if it was already provided, otherwise |
| 256 | // query AskPass for it |
| 257 | if given, ok := what[valueString]; ok && len(given) > 0 { |
| 258 | return given[0], nil |
| 259 | } |
| 260 | return a.getFromProgramscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#getFromProgram().(valueType, u) |
| 261 | } |
| 262 | |
| 263 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) getFromProgramscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#getFromProgram().(valueType credValueTypescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueType#, u *urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/URL#) (string, error) { |
| 264 | var ( |
| 265 | value bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 266 | err bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 267 | |
| 268 | valueString string |
| 269 | ) |
| 270 | |
| 271 | switch valueType { |
| 272 | case credValueTypeUsernamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypeUsername.: |
| 273 | valueString = "Username" |
| 274 | case credValueTypePasswordscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credValueTypePassword.: |
| 275 | valueString = "Password" |
| 276 | default: |
| 277 | return "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("Invalid Credential type queried from AskPass")) |
| 278 | } |
| 279 | |
| 280 | // 'cmd' will run the GIT_ASKPASS (or core.askpass) command prompting |
| 281 | // for the desired valueType (`Username` or `Password`) |
| 282 | cmd, errVal := subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.ExecCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ExecCommand().(a.Programscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Program., a.argsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#args().(fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%s for %q", valueString, u))...) |
| 283 | if errVal != nil { |
| 284 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("creds: failed to find GIT_ASKPASS command: %s", a.Programscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Program.) |
| 285 | return "", errVal |
| 286 | } |
| 287 | cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = &err |
| 288 | cmd.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = &value |
| 289 | |
| 290 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("creds: filling with GIT_ASKPASS: %s", stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(cmd.Argsscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Args., " ")) |
| 291 | if err := cmd.Runscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Run().(); err != nil { |
| 292 | return "", err |
| 293 | } |
| 294 | |
| 295 | if err.Lenscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#Len().() > 0 { |
| 296 | return "", errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(err.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().()) |
| 297 | } |
| 298 | |
| 299 | return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.TrimSpacescip-go gomod github.com/golang/go/src go1.25.0 strings/TrimSpace().(value.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().()), nil |
| 300 | } |
| 301 | |
| 302 | // Approve implements CredentialHelper.Approve, and returns nil. The ASKPASS |
| 303 | // credential helper does not implement credential approval. |
| 304 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Approve().(_ Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { return nil } |
| 305 | |
| 306 | // Reject implements CredentialHelper.Reject, and returns nil. The ASKPASS |
| 307 | // credential helper does not implement credential rejection. |
| 308 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#Reject().(_ Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { return nil } |
| 309 | |
| 310 | // args returns the arguments given to the ASKPASS program, if a prompt was |
| 311 | // given. |
| 312 | |
| 313 | // See: https://git-scm.com/docs/gitcredentials#_requesting_credentials for |
| 314 | // more. |
| 315 | func (a *AskPassCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#) argsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/AskPassCredentialHelper#args().(prompt string) []string { |
| 316 | if len(prompt) == 0 { |
| 317 | return nil |
| 318 | } |
| 319 | return []string{prompt} |
| 320 | } |
| 321 | |
| 322 | type commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper# struct { |
| 323 | SkipPromptscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#SkipPrompt. bool |
| 324 | protectProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#protectProtocol. bool |
| 325 | } |
| 326 | |
| 327 | func (h *commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#Fill().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 328 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("creds: git credential fill (%q, %q, %q)", |
| 329 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "protocol"), |
| 330 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "host"), |
| 331 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "path")) |
| 332 | return h.execscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#exec().("fill", creds) |
| 333 | } |
| 334 | |
| 335 | func (h *commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#Reject().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 336 | _, err := h.execscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#exec().("reject", creds) |
| 337 | return err |
| 338 | } |
| 339 | |
| 340 | func (h *commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#Approve().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 341 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("creds: git credential approve (%q, %q, %q)", |
| 342 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "protocol"), |
| 343 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "host"), |
| 344 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "path")) |
| 345 | _, err := h.execscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#exec().("approve", creds) |
| 346 | return err |
| 347 | } |
| 348 | |
| 349 | func (h *commandCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#) execscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#exec().(subcommand string, input Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 350 | output := new(bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#) |
| 351 | cmd, err := subprocessscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/.ExecCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/ExecCommand().("git", "credential", subcommand) |
| 352 | if err != nil { |
| 353 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("failed to find `git credential %s`: %v", subcommand, err)) |
| 354 | } |
| 355 | cmd.Stdinscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdin., err = input.bufferscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#buffer().(h.protectProtocolscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#protectProtocol.) |
| 356 | if err != nil { |
| 357 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("invalid input to `git credential %s`: %v", subcommand, err)) |
| 358 | } |
| 359 | cmd.Stdoutscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stdout. = output |
| 360 | /* |
| 361 | There is a reason we don't read from stderr here: |
| 362 | Git's credential cache daemon helper does not close its stderr, so if this |
| 363 | process is the process that fires up the daemon, it will wait forever |
| 364 | (until the daemon exits, really) trying to read from stderr. |
| 365 | |
| 366 | Instead, we simply pass it through to our stderr. |
| 367 | |
| 368 | See https://github.com/git-lfs/git-lfs/issues/117 for more details. |
| 369 | */ |
| 370 | cmd.Stderrscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Stderr. = osscip-go gomod github.com/golang/go/src go1.25.0 os/.Stderrscip-go gomod github.com/golang/go/src go1.25.0 os/Stderr. |
| 371 | |
| 372 | err = cmd.Startscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Start().() |
| 373 | if err == nil { |
| 374 | err = cmd.Waitscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/subprocess`/Cmd#Wait().() |
| 375 | } |
| 376 | |
| 377 | if _, ok := err.(*execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.ExitErrorscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/ExitError#); ok { |
| 378 | if h.SkipPromptscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/commandCredentialHelper#SkipPrompt. { |
| 379 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("change the GIT_TERMINAL_PROMPT env var to be prompted to enter your credentials for %s://%s", |
| 380 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(input, "protocol"), FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(input, "host"))) |
| 381 | } |
| 382 | |
| 383 | // 'git credential' exits with 128 if the helper doesn't fill the username |
| 384 | // and password values. |
| 385 | if subcommand == "fill" && err.Error() == "exit status 128" { |
| 386 | return nil, nil |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | if err != nil { |
| 391 | return nil, errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("`git credential %s` error: %s", subcommand, err.Error())) |
| 392 | } |
| 393 | |
| 394 | creds := make(Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) |
| 395 | for _, line := range stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Splitscip-go gomod github.com/golang/go/src go1.25.0 strings/Split().(output.Stringscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer#String().(), "\n") { |
| 396 | pieces := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.SplitNscip-go gomod github.com/golang/go/src go1.25.0 strings/SplitN().(line, "=", 2) |
| 397 | if len(pieces) < 2 || len(pieces[1]) < 1 { |
| 398 | continue |
| 399 | } |
| 400 | if _, ok := creds[pieces[0]]; ok { |
| 401 | creds[pieces[0]] = append(creds[pieces[0]], pieces[1]) |
| 402 | } else { |
| 403 | creds[pieces[0]] = []string{pieces[1]} |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | return creds, nil |
| 408 | } |
| 409 | |
| 410 | type credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher# struct { |
| 411 | credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds. map[string]Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds# |
| 412 | muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex# |
| 413 | } |
| 414 | |
| 415 | func NewCredentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialCacher().() *credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher# { |
| 416 | return &credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#{credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds.: make(map[string]Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#)} |
| 417 | } |
| 418 | |
| 419 | func credCacheKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credCacheKey().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) string { |
| 420 | parts := []string{ |
| 421 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "protocol"), |
| 422 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "host"), |
| 423 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(creds, "path"), |
| 424 | } |
| 425 | return stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(parts, "//") |
| 426 | } |
| 427 | |
| 428 | func (c *credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#Fill().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 429 | key := credCacheKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credCacheKey().(what) |
| 430 | c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 431 | cached, ok := c.credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds.[key] |
| 432 | c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 433 | |
| 434 | if ok { |
| 435 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("creds: git credential cache (%q, %q, %q)", |
| 436 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "protocol"), |
| 437 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "host"), |
| 438 | FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(what, "path")) |
| 439 | return cached, nil |
| 440 | } |
| 441 | |
| 442 | return nil, credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. |
| 443 | } |
| 444 | |
| 445 | func (c *credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#Approve().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 446 | key := credCacheKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credCacheKey().(what) |
| 447 | |
| 448 | c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 449 | defer c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 450 | |
| 451 | if _, ok := c.credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds.[key]; ok { |
| 452 | return nil |
| 453 | } |
| 454 | |
| 455 | c.credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds.[key] = what |
| 456 | return credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. |
| 457 | } |
| 458 | |
| 459 | func (c *credentialCacherscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#Reject().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 460 | key := credCacheKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credCacheKey().(what) |
| 461 | c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 462 | delete(c.credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#creds., key) |
| 463 | c.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credentialCacher#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 464 | return credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. |
| 465 | } |
| 466 | |
| 467 | // CredentialHelpers iterates through a slice of CredentialHelper objects |
| 468 | // CredentialHelpers is a []CredentialHelper that iterates through each |
| 469 | // credential helper to fill, reject, or approve credentials. Typically, the |
| 470 | // first success returns immediately. Errors are reported to tracerx, unless |
| 471 | // all credential helpers return errors. Any erroring credential helpers are |
| 472 | // skipped for future calls. |
| 473 | // |
| 474 | // A CredentialHelper can return a credHelperNoOp error, signaling that the |
| 475 | // CredentialHelpers should try the next one. |
| 476 | type CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers# struct { |
| 477 | helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers. []CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper# |
| 478 | skippedHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skippedHelpers. map[int]bool |
| 479 | muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#mu. syncscip-go gomod github.com/golang/go/src go1.25.0 sync/.Mutexscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex# |
| 480 | } |
| 481 | |
| 482 | // NewCredentialHelpers initializes a new CredentialHelpers from the given |
| 483 | // slice of CredentialHelper instances. |
| 484 | func NewCredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NewCredentialHelpers().(helpers []CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#) CredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper# { |
| 485 | return &CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#{ |
| 486 | helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers.: helpers, |
| 487 | skippedHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skippedHelpers.: make(map[int]bool), |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | var credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("no-op!") |
| 492 | |
| 493 | // Fill implements CredentialHelper.Fill by asking each CredentialHelper in |
| 494 | // order to fill the credentials. |
| 495 | // |
| 496 | // If a fill was successful, it is returned immediately, and no other |
| 497 | // `CredentialHelper`s are consulted. If any CredentialHelper returns an error, |
| 498 | // it is reported to tracerx, and the next one is attempted. If they all error, |
| 499 | // then a collection of all the error messages is returned. Erroring credential |
| 500 | // helpers are added to the skip list, and never attempted again for the |
| 501 | // lifetime of the current Git LFS command. |
| 502 | func (s *CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#Fill().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 503 | var multiErr error |
| 504 | for i, h := range s.helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers. { |
| 505 | if s.skippedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skipped().(i) { |
| 506 | continue |
| 507 | } |
| 508 | |
| 509 | creds, err := h.Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Fill.(what) |
| 510 | if err != nil { |
| 511 | if err != credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. { |
| 512 | s.skipscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skip().(i) |
| 513 | tracerxscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/.Printfscip-go gomod github.com/rubyist/tracerx 787959303086 `github.com/rubyist/tracerx`/Printf().("credential fill error: %s", err) |
| 514 | multiErr = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Joinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Join().(multiErr, err) |
| 515 | } |
| 516 | continue |
| 517 | } |
| 518 | |
| 519 | if creds != nil { |
| 520 | return creds, nil |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | if multiErr != nil { |
| 525 | multiErr = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Joinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Join().(errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("credential fill errors:")), multiErr) |
| 526 | } |
| 527 | |
| 528 | return nil, multiErr |
| 529 | } |
| 530 | |
| 531 | // Reject implements CredentialHelper.Reject and rejects the given Creds "what" |
| 532 | // with the first successful attempt. |
| 533 | func (s *CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#Reject().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 534 | for i, h := range s.helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers. { |
| 535 | if s.skippedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skipped().(i) { |
| 536 | continue |
| 537 | } |
| 538 | |
| 539 | if err := h.Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(what); err != credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. { |
| 540 | return err |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | return errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("no valid credential helpers to reject")) |
| 545 | } |
| 546 | |
| 547 | // Approve implements CredentialHelper.Approve and approves the given Creds |
| 548 | // "what" with the first successful CredentialHelper. If an error occurs, |
| 549 | // it calls Reject() with the same Creds and returns the error immediately. This |
| 550 | // ensures a caching credential helper removes the cache, since the Erroring |
| 551 | // CredentialHelper never successfully saved it. |
| 552 | func (s *CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#Approve().(what Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 553 | skipped := make(map[int]bool) |
| 554 | for i, h := range s.helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers. { |
| 555 | if s.skippedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skipped().(i) { |
| 556 | skipped[i] = true |
| 557 | continue |
| 558 | } |
| 559 | |
| 560 | if err := h.Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Approve.(what); err != credHelperNoOpscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/credHelperNoOp. { |
| 561 | if err != nil && i > 0 { // clear any cached approvals |
| 562 | for j := 0; j < i; j++ { |
| 563 | if !skipped[j] { |
| 564 | s.helpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#helpers.[j].Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelper#Reject.(what) |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 | return err |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | return errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("no valid credential helpers to approve")) |
| 573 | } |
| 574 | |
| 575 | func (s *CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#) skipscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skip().(i int) { |
| 576 | s.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 577 | s.skippedHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skippedHelpers.[i] = true |
| 578 | s.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 579 | } |
| 580 | |
| 581 | func (s *CredentialHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#) skippedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skipped().(i int) bool { |
| 582 | s.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#mu..Lockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Lock().() |
| 583 | skipped := s.skippedHelpersscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#skippedHelpers.[i] |
| 584 | s.muscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/CredentialHelpers#mu..Unlockscip-go gomod github.com/golang/go/src go1.25.0 sync/Mutex#Unlock().() |
| 585 | return skipped |
| 586 | } |
| 587 | |
| 588 | type nullCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper# struct{} |
| 589 | |
| 590 | var ( |
| 591 | nullCredErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredError. = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().(trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/.Trscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/tr`/Tr..Getscip-go gomod github.com/leonelquinteros/gotext v1.7.2 `github.com/leonelquinteros/gotext`/Locale#Get().("No credential helper configured")) |
| 592 | NullCredsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/NullCreds. = &nullCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#{} |
| 593 | ) |
| 594 | |
| 595 | func (h *nullCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#) Fillscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#Fill().(input Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) (Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, error) { |
| 596 | return nil, nullCredErrorscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredError. |
| 597 | } |
| 598 | |
| 599 | func (h *nullCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#) Approvescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#Approve().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 600 | return nil |
| 601 | } |
| 602 | |
| 603 | func (h *nullCredentialHelperscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#) Rejectscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/nullCredentialHelper#Reject().(creds Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#) error { |
| 604 | return nil |
| 605 | } |
| 606 | |
| 607 | // FirstEntryForKey extracts and returns the first entry for a given key, or |
| 608 | // returns the empty string if no value for that key is available. |
| 609 | func FirstEntryForKeyscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/FirstEntryForKey().(input Credsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/creds`/Creds#, key string) string { |
| 610 | if val, ok := input[key]; ok && len(val) > 0 { |
| 611 | return val[0] |
| 612 | } |
| 613 | return "" |
| 614 | } |