Handle erase operation in auth git-credential command (#6805)
This commit is contained in:
parent
08d7ea5f62
commit
47b27cde4b
2 changed files with 25 additions and 1 deletions
|
|
@ -54,7 +54,12 @@ func NewCmdCredential(f *cmdutil.Factory, runF func(*CredentialOptions) error) *
|
|||
func helperRun(opts *CredentialOptions) error {
|
||||
if opts.Operation == "store" {
|
||||
// We pretend to implement the "store" operation, but do nothing since we already have a cached token.
|
||||
return cmdutil.SilentError
|
||||
return nil
|
||||
}
|
||||
|
||||
if opts.Operation == "erase" {
|
||||
// We pretend to implement the "erase" operation, but do nothing since we don't want git to cause user to be logged out.
|
||||
return nil
|
||||
}
|
||||
|
||||
if opts.Operation != "get" {
|
||||
|
|
|
|||
|
|
@ -218,6 +218,25 @@ func Test_helperRun(t *testing.T) {
|
|||
`),
|
||||
wantStderr: "",
|
||||
},
|
||||
{
|
||||
name: "noop store operation",
|
||||
opts: CredentialOptions{
|
||||
Operation: "store",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "noop erase operation",
|
||||
opts: CredentialOptions{
|
||||
Operation: "erase",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "unknown operation",
|
||||
opts: CredentialOptions{
|
||||
Operation: "unknown",
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue