Repository: cli/cli
Pull request #10279 (2025-01-20 15:28:03)

Bump golangci-linter and address failures to prepare for Go 1.24 strictness
Go 1.24 introduces stricter checks for format string validation. This commit fixes instances where non-constant format strings were used in calls to functions like `fmt.Errorf`, `fmt.Printf`, and similar.


Patch:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 0a6c0d9db..f1ae1e522 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -32,7 +32,7 @@ jobs:
           go mod verify
           go mod download
 
-          LINT_VERSION=1.59.1
+          LINT_VERSION=1.63.4
           curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
             tar xz --strip-components 1 --wildcards \*/golangci-lint
           mkdir -p bin && mv golangci-lint bin/
@@ -53,6 +53,6 @@ jobs:
           assert-nothing-changed go fmt ./...
           assert-nothing-changed go mod tidy
 
-          bin/golangci-lint run --out-format=github-actions --timeout=3m || STATUS=$?
+          bin/golangci-lint run --out-format=colored-line-number --timeout=3m || STATUS=$?
 
           exit $STATUS
diff --git a/internal/gh/gh.go b/internal/gh/gh.go
index 8e640c41a..e4431fdab 100644
--- a/internal/gh/gh.go
+++ b/internal/gh/gh.go
@@ -90,7 +90,7 @@ type Migration interface {
 }
 
 // AuthConfig is used for interacting with some persistent configuration for gh,
-// with knowledge on how to access encrypted storage when necessary.
+// with knowledge on how to access encrypted storage when neccesarry.
 // Behavior is scoped to authentication specific tasks.
 type AuthConfig interface {
 	// HasActiveToken returns true when a token for the hostname is present.
diff --git a/pkg/cmd/auth/token/token.go b/pkg/cmd/auth/token/token.go
index 9f4dcc1ac..d9faac7d8 100644
--- a/pkg/cmd/auth/token/token.go
+++ b/pkg/cmd/auth/token/token.go
@@ -1,6 +1,7 @@
 package token
 
 import (
+	"errors"
 	"fmt"
 
 	"github.com/MakeNowJust/heredoc"
@@ -88,7 +89,7 @@ func tokenRun(opts *TokenOptions) error {
 		if opts.Username != "" {
 			errMsg += fmt.Sprintf(" account %s", opts.Username)
 		}
-		return fmt.Errorf(errMsg)
+		return errors.New(errMsg)
 	}
 
 	if val != "" {
diff --git a/pkg/cmd/factory/remote_resolver.go b/pkg/cmd/factory/remote_resolver.go
index b008ade7e..7e27834e2 100644
--- a/pkg/cmd/factory/remote_resolver.go
+++ b/pkg/cmd/factory/remote_resolver.go
@@ -69,7 +69,6 @@ func (rr *remoteResolver) Resolver() func() (context.Remotes, error) {
 		sort.Sort(resolvedRemotes)
 
 		// Filter remotes by hosts
-		// Note that this is not caching correctly: https://github.com/cli/cli/issues/10103
 		cachedRemotes := resolvedRemotes.FilterByHosts(hosts)
 
 		// Filter again by default host if one is set
diff --git a/pkg/cmd/gist/edit/edit.go b/pkg/cmd/gist/edit/edit.go
index e0d6e3b84..1e9b61825 100644
--- a/pkg/cmd/gist/edit/edit.go
+++ b/pkg/cmd/gist/edit/edit.go
@@ -108,10 +108,6 @@ func editRun(opts *EditOptions) error {
 	if gistID == "" {
 		cs := opts.IO.ColorScheme()
 		if gistID == "" {
-			if !opts.IO.CanPrompt() {
-				return cmdutil.FlagErrorf("gist ID or URL required when not running interactively")
-			}
-
 			gist, err := shared.PromptGists(opts.Prompter, client, host, cs)
 			if err != nil {
 				return err
diff --git a/pkg/cmd/gist/view/view.go b/pkg/cmd/gist/view/view.go
index 705f8f703..adfe77f6f 100644
--- a/pkg/cmd/gist/view/view.go
+++ b/pkg/cmd/gist/view/view.go
@@ -89,10 +89,6 @@ func viewRun(opts *ViewOptions) error {
 
 	cs := opts.IO.ColorScheme()
 	if gistID == "" {
-		if !opts.IO.CanPrompt() {
-			return cmdutil.FlagErrorf("gist ID or URL required when not running interactively")
-		}
-
 		gist, err := shared.PromptGists(opts.Prompter, client, hostname, cs)
 		if err != nil {
 			return err
diff --git a/pkg/cmd/pr/merge/merge.go b/pkg/cmd/pr/merge/merge.go
index 6696fac85..422b5e93e 100644
--- a/pkg/cmd/pr/merge/merge.go
+++ b/pkg/cmd/pr/merge/merge.go
@@ -384,13 +384,14 @@ func (m *mergeContext) deleteLocalBranch() error {
 
 	if m.merged {
 		if m.opts.IO.CanPrompt() && !m.opts.IsDeleteBranchIndicated {
-			confirmed, err := m.opts.Prompter.Confirm(fmt.Sprintf("Pull request %s#%d was already merged. Delete the branch locally?", ghrepo.FullName(m.baseRepo), m.pr.Number), false)
+			message := fmt.Sprintf("Pull request %s#%d was already merged. Delete the branch locally?", ghrepo.FullName(m.baseRepo), m.pr.Number)
+			confirmed, err := m.opts.Prompter.Confirm(message, false)
 			if err != nil {
 				return fmt.Errorf("could not prompt: %w", err)
 			}
 			m.deleteBranch = confirmed
 		} else {
-			_ = m.warnf(fmt.Sprintf("%s Pull request %s#%d was already merged\n", m.cs.WarningIcon(), ghrepo.FullName(m.baseRepo), m.pr.Number))
+			_ = m.warnf("%s Pull request %s#%d was already merged\n", m.cs.WarningIcon(), ghrepo.FullName(m.baseRepo), m.pr.Number)
 		}
 	}
 
@@ -431,7 +432,7 @@ func (m *mergeContext) deleteLocalBranch() error {
 		}
 
 		if err := m.opts.GitClient.Pull(ctx, baseRemote.Name, targetBranch); err != nil {
-			_ = m.warnf(fmt.Sprintf("%s warning: not possible to fast-forward to: %q\n", m.cs.WarningIcon(), targetBranch))
+			_ = m.warnf("%s warning: not possible to fast-forward to: %q\n", m.cs.WarningIcon(), targetBranch)
 		}
 
 		switchedToBranch = targetBranch
diff --git a/pkg/cmd/repo/setdefault/setdefault.go b/pkg/cmd/repo/setdefault/setdefault.go
index 3e1554a69..eb8fcfb5a 100644
--- a/pkg/cmd/repo/setdefault/setdefault.go
+++ b/pkg/cmd/repo/setdefault/setdefault.go
@@ -30,8 +30,7 @@ func explainer() string {
 		 - viewing and creating issues
 		 - viewing and creating releases
 		 - working with GitHub Actions
-
-		### NOTE: gh does not use the default repository for managing repository and environment secrets.`)
+		 - adding repository and environment secrets`)
 }
 
 type iprompter interface {
diff --git a/pkg/cmd/repo/view/view.go b/pkg/cmd/repo/view/view.go
index d0370203a..06f85d048 100644
--- a/pkg/cmd/repo/view/view.go
+++ b/pkg/cmd/repo/view/view.go
@@ -156,7 +156,7 @@ func viewRun(opts *ViewOptions) error {
 		fmt.Fprintf(stdout, "description:\t%s\n", repo.Description)
 		if readme != nil {
 			fmt.Fprintln(stdout, "--")
-			fmt.Fprintf(stdout, readme.Content)
+			fmt.Fprint(stdout, readme.Content)
 			fmt.Fprintln(stdout)
 		}
 
diff --git a/pkg/cmd/ruleset/shared/shared.go b/pkg/cmd/ruleset/shared/shared.go
index 3ec1c83ee..536e8a5a9 100644
--- a/pkg/cmd/ruleset/shared/shared.go
+++ b/pkg/cmd/ruleset/shared/shared.go
@@ -78,7 +78,7 @@ func ParseRulesForDisplay(rules []RulesetRule) string {
 	for _, rule := range rules {
 		display.WriteString(fmt.Sprintf("- %s", rule.Type))
 
-		if rule.Parameters != nil && len(rule.Parameters) > 0 {
+		if len(rule.Parameters) > 0 {
 			display.WriteString(": ")
 
 			// sort these keys too for consistency
diff --git a/pkg/cmd/secret/delete/delete.go b/pkg/cmd/secret/delete/delete.go
index 84a5e7a83..564e8633f 100644
--- a/pkg/cmd/secret/delete/delete.go
+++ b/pkg/cmd/secret/delete/delete.go
@@ -46,19 +46,8 @@ func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Co
 		`),
 		Args: cobra.ExactArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
-			// If the user specified a repo directly, then we're using the OverrideBaseRepoFunc set by EnableRepoOverride
-			// So there's no reason to use the specialised BaseRepoFunc that requires remote disambiguation.
+			// support `-R, --repo` override
 			opts.BaseRepo = f.BaseRepo
-			if !cmd.Flags().Changed("repo") {
-				// If they haven't specified a repo directly, then we will wrap the BaseRepoFunc in one that errors if
-				// there might be multiple valid remotes.
-				opts.BaseRepo = shared.RequireNoAmbiguityBaseRepoFunc(opts.BaseRepo, f.Remotes)
-				// But if we are able to prompt, then we will wrap that up in a BaseRepoFunc that can prompt the user to
-				// resolve the ambiguity.
-				if opts.IO.CanPrompt() {
-					opts.BaseRepo = shared.PromptWhenAmbiguousBaseRepoFunc(opts.BaseRepo, f.IOStreams, f.Prompter)
-				}
-			}
 
 			if err := cmdutil.MutuallyExclusive("specify only one of `--org`, `--env`, or `--user`", opts.OrgName != "", opts.EnvName != "", opts.UserSecrets); err != nil {
 				return err
@@ -99,14 +88,6 @@ func removeRun(opts *DeleteOptions) error {
 		return err
 	}
 
-	var baseRepo ghrepo.Interface
-	if secretEntity == shared.Repository || secretEntity == shared.Environment {
-		baseRepo, err = opts.BaseRepo()
-		if err != nil {
-			return err
-		}
-	}
-
 	secretApp, err := shared.GetSecretApp(opts.Application, secretEntity)
 	if err != nil {
 		return err
@@ -116,6 +97,14 @@ func removeRun(opts *DeleteOptions) error {
 		return fmt.Errorf("%s secrets are not supported for %s", secretEntity, secretApp)
 	}
 
+	var baseRepo ghrepo.Interface
+	if secretEntity == shared.Repository || secretEntity == shared.Environment {
+		baseRepo, err = opts.BaseRepo()
+		if err != nil {
+			return err
+		}
+	}
+
 	cfg, err := opts.Config()
 	if err != nil {
 		return err
diff --git a/pkg/cmd/secret/list/list.go b/pkg/cmd/secret/list/list.go
index af3526386..9e1fd305d 100644
--- a/pkg/cmd/secret/list/list.go
+++ b/pkg/cmd/secret/list/list.go
@@ -11,7 +11,6 @@ import (
 	"github.com/cli/cli/v2/api"
 	"github.com/cli/cli/v2/internal/gh"
 	"github.com/cli/cli/v2/internal/ghrepo"
-	"github.com/cli/cli/v2/internal/prompter"
 	"github.com/cli/cli/v2/internal/tableprinter"
 	"github.com/cli/cli/v2/pkg/cmd/secret/shared"
 	"github.com/cli/cli/v2/pkg/cmdutil"
@@ -24,10 +23,8 @@ type ListOptions struct {
 	IO         *iostreams.IOStreams
 	Config     func() (gh.Config, error)
 	BaseRepo   func() (ghrepo.Interface, error)
-	Prompter   prompter.Prompter
-
-	Now      func() time.Time
-	Exporter cmdutil.Exporter
+	Now        func() time.Time
+	Exporter   cmdutil.Exporter
 
 	OrgName     string
 	EnvName     string
@@ -51,7 +48,6 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
 		Config:     f.Config,
 		HttpClient: f.HttpClient,
 		Now:        time.Now,
-		Prompter:   f.Prompter,
 	}
 
 	cmd := &cobra.Command{
@@ -67,19 +63,8 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
 		Aliases: []string{"ls"},
 		Args:    cobra.NoArgs,
 		RunE: func(cmd *cobra.Command, args []string) error {
-			// If the user specified a repo directly, then we're using the OverrideBaseRepoFunc set by EnableRepoOverride
-			// So there's no reason to use the specialised BaseRepoFunc that requires remote disambiguation.
+			// support `-R, --repo` override
 			opts.BaseRepo = f.BaseRepo
-			if !cmd.Flags().Changed("repo") {
-				// If they haven't specified a repo directly, then we will wrap the BaseRepoFunc in one that errors if
-				// there might be multiple valid remotes.
-				opts.BaseRepo = shared.RequireNoAmbiguityBaseRepoFunc(opts.BaseRepo, f.Remotes)
-				// But if we are able to prompt, then we will wrap that up in a BaseRepoFunc that can prompt the user to
-				// resolve the ambiguity.
-				if opts.IO.CanPrompt() {
-					opts.BaseRepo = shared.PromptWhenAmbiguousBaseRepoFunc(opts.BaseRepo, f.IOStreams, f.Prompter)
-				}
-			}
 
 			if err := cmdutil.MutuallyExclusive("specify only one of `--org`, `--env`, or `--user`", opts.OrgName != "", opts.EnvName != "", opts.UserSecrets); err != nil {
 				return err
diff --git a/pkg/cmd/secret/set/set.go b/pkg/cmd/secret/set/set.go
index 3c12b4192..755bdda1f 100644
--- a/pkg/cmd/secret/set/set.go
+++ b/pkg/cmd/secret/set/set.go
@@ -9,8 +9,6 @@ import (
 	"os"
 	"strings"
 
-	"github.com/cli/cli/v2/internal/prompter"
-
 	"github.com/MakeNowJust/heredoc"
 	"github.com/cli/cli/v2/api"
 	"github.com/cli/cli/v2/internal/gh"
@@ -29,7 +27,7 @@ type SetOptions struct {
 	IO         *iostreams.IOStreams
 	Config     func() (gh.Config, error)
 	BaseRepo   func() (ghrepo.Interface, error)
-	Prompter   prompter.Prompter
+	Prompter   iprompter
 
 	RandomOverride func() io.Reader
 
@@ -45,6 +43,10 @@ type SetOptions struct {
 	Application     string
 }
 
+type iprompter interface {
+	Password(string) (string, error)
+}
+
 func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command {
 	opts := &SetOptions{
 		IO:         f.IOStreams,
@@ -75,9 +77,6 @@ func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command
 			# Read secret value from an environment variable
 			$ gh secret set MYSECRET --body "$ENV_VALUE"
 
-			# Set secret for a specific remote repository
-			$ gh secret set MYSECRET --repo origin/repo --body "$ENV_VALUE"
-
 			# Read secret value from a file
 			$ gh secret set MYSECRET < myfile.txt
 
@@ -104,19 +103,8 @@ func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command
 		`),
 		Args: cobra.MaximumNArgs(1),
 		RunE: func(cmd *cobra.Command, args []string) error {
-			// If the user specified a repo directly, then we're using the OverrideBaseRepoFunc set by EnableRepoOverride
-			// So there's no reason to use the specialised BaseRepoFunc that requires remote disambiguation.
+			// support `-R, --repo` override
 			opts.BaseRepo = f.BaseRepo
-			if !cmd.Flags().Changed("repo") {
-				// If they haven't specified a repo directly, then we will wrap the BaseRepoFunc in one that errors if
-				// there might be multiple valid remotes.
-				opts.BaseRepo = shared.RequireNoAmbiguityBaseRepoFunc(opts.BaseRepo, f.Remotes)
-				// But if we are able to prompt, then we will wrap that up in a BaseRepoFunc that can prompt the user to
-				// resolve the ambiguity.
-				if opts.IO.CanPrompt() {
-					opts.BaseRepo = shared.PromptWhenAmbiguousBaseRepoFunc(opts.BaseRepo, f.IOStreams, f.Prompter)
-				}
-			}
 
 			if err := cmdutil.MutuallyExclusive("specify only one of `--org`, `--env`, or `--user`", opts.OrgName != "", opts.EnvName != "", opts.UserSecrets); err != nil {
 				return err
@@ -178,18 +166,27 @@ func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command
 }
 
 func setRun(opts *SetOptions) error {
+	secrets, err := getSecretsFromOptions(opts)
+	if err != nil {
+		return err
+	}
+
+	c, err := opts.HttpClient()
+	if err != nil {
+		return fmt.Errorf("could not create http client: %w", err)
+	}
+	client := api.NewClientFromHTTP(c)
+
 	orgName := opts.OrgName
 	envName := opts.EnvName
 
 	var host string
 	var baseRepo ghrepo.Interface
 	if orgName == "" && !opts.UserSecrets {
-		var err error
 		baseRepo, err = opts.BaseRepo()
 		if err != nil {
 			return err
 		}
-
 		host = baseRepo.RepoHost()
 	} else {
 		cfg, err := opts.Config()
@@ -199,17 +196,6 @@ func setRun(opts *SetOptions) error {
 		host, _ = cfg.Authentication().DefaultHost()
 	}
 
-	secrets, err := getSecretsFromOptions(opts)
-	if err != nil {
-		return err
-	}
-
-	c, err := opts.HttpClient()
-	if err != nil {
-		return fmt.Errorf("could not create http client: %w", err)
-	}
-	client := api.NewClientFromHTTP(c)
-
 	secretEntity, err := shared.GetSecretEntity(orgName, envName, opts.UserSecrets)
 	if err != nil {
 		return err
diff --git a/pkg/cmd/secret/shared/base_repo.go b/pkg/cmd/secret/shared/base_repo.go
deleted file mode 100644
index 308117ac6..000000000
--- a/pkg/cmd/secret/shared/base_repo.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package shared
-
-import (
-	"errors"
-	"fmt"
-
-	ghContext "github.com/cli/cli/v2/context"
-	"github.com/cli/cli/v2/internal/ghrepo"
-	"github.com/cli/cli/v2/internal/prompter"
-	"github.com/cli/cli/v2/pkg/iostreams"
-)
-
-type AmbiguousBaseRepoError struct {
-	Remotes ghContext.Remotes
-}
-
-func (e AmbiguousBaseRepoError) Error() string {
-	return "multiple remotes detected. please specify which repo to use by providing the -R, --repo argument"
-}
-
-type baseRepoFn func() (ghrepo.Interface, error)
-type remotesFn func() (ghContext.Remotes, error)
-
-func PromptWhenAmbiguousBaseRepoFunc(baseRepoFn baseRepoFn, ios *iostreams.IOStreams, prompter prompter.Prompter) baseRepoFn {
-	return func() (ghrepo.Interface, error) {
-		baseRepo, err := baseRepoFn()
-		if err != nil {
-			var ambiguousBaseRepoErr AmbiguousBaseRepoError
-			if !errors.As(err, &ambiguousBaseRepoErr) {
-				return nil, err
-			}
-
-			baseRepoOptions := make([]string, len(ambiguousBaseRepoErr.Remotes))
-			for i, remote := range ambiguousBaseRepoErr.Remotes {
-				baseRepoOptions[i] = ghrepo.FullName(remote)
-			}
-
-			fmt.Fprintf(ios.Out, "%s Multiple remotes detected. Due to the sensitive nature of secrets, requiring disambiguation.\n", ios.ColorScheme().WarningIcon())
-			selectedBaseRepo, err := prompter.Select("Select a repo", baseRepoOptions[0], baseRepoOptions)
-			if err != nil {
-				return nil, err
-			}
-
-			selectedRepo, err := ghrepo.FromFullName(baseRepoOptions[selectedBaseRepo])
-			if err != nil {
-				return nil, err
-			}
-
-			return selectedRepo, nil
-		}
-
-		return baseRepo, nil
-	}
-}
-
-// RequireNoAmbiguityBaseRepoFunc returns a function to resolve the base repo, ensuring that
-// there was only one option, regardless of whether the base repo had been set.
-func RequireNoAmbiguityBaseRepoFunc(baseRepo baseRepoFn, remotes remotesFn) baseRepoFn {
-	return func() (ghrepo.Interface, error) {
-		remotes, err := remotes()
-		if err != nil {
-			return nil, err
-		}
-
-		if remotes.Len() > 1 {
-			return nil, AmbiguousBaseRepoError{Remotes: remotes}
-		}
-
-		return baseRepo()
-	}
-}
diff --git a/pkg/cmdutil/json_flags.go b/pkg/cmdutil/json_flags.go
index 440e0e0b8..596c2f216 100644
--- a/pkg/cmdutil/json_flags.go
+++ b/pkg/cmdutil/json_flags.go
@@ -254,7 +254,7 @@ func (e *jsonExporter) exportData(v reflect.Value) interface{} {
 		}
 		return m.Interface()
 	case reflect.Struct:
-		if v.CanAddr() && reflect.PtrTo(v.Type()).Implements(exportableType) {
+		if v.CanAddr() && reflect.PointerTo(v.Type()).Implements(exportableType) {
 			ve := v.Addr().Interface().(exportable)
 			return ve.ExportData(e.fields)
 		} else if v.Type().Implements(exportableType) {


Test patch:
diff --git a/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar b/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar
deleted file mode 100644
index f4d1bbb4a..000000000
--- a/acceptance/testdata/secret/secret-require-remote-disambiguation.txtar
+++ /dev/null
@@ -1,36 +0,0 @@
-# Set up env vars
-env REPO=${SCRIPT_NAME}-${RANDOM_STRING}
-
-# Use gh as a credential helper
-exec gh auth setup-git
-
-# Create a repository with a file so it has a default branch
-exec gh repo create ${ORG}/${REPO} --add-readme --private
-
-# Defer repo cleanup
-defer gh repo delete --yes ${ORG}/${REPO}
-
-# Create a fork
-exec gh repo fork ${ORG}/${REPO} --org ${ORG} --fork-name ${REPO}-fork
-
-# Defer fork cleanup
-defer gh repo delete --yes ${ORG}/${REPO}-fork
-
-# Sleep to allow the fork to be created before cloning
-sleep 2
-
-# Clone and move into the fork repo
-exec gh repo clone ${ORG}/${REPO}-fork
-cd ${REPO}-fork
-
-# Secret list requires disambiguation
-! exec gh secret list
-stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument'
-
-# Secret set requires disambiguation
-! exec gh secret set 'TEST_SECRET_NAME' --body 'TEST_SECRET_VALUE'
-stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument'
-
-# Secret delete requires disambiguation
-! exec gh secret delete 'TEST_SECRET_NAME'
-stderr 'multiple remotes detected. please specify which repo to use by providing the -R, --repo argument'
diff --git a/pkg/cmd/codespace/create_test.go b/pkg/cmd/codespace/create_test.go
index 6466d9be7..c5f11bd2f 100644
--- a/pkg/cmd/codespace/create_test.go
+++ b/pkg/cmd/codespace/create_test.go
@@ -648,14 +648,14 @@ Alternatively, you can run "create" with the "--default-permissions" option to c
 				assert.EqualError(t, err, tt.wantErr.Error())
 			}
 			if err != nil && tt.wantErr == nil {
-				t.Logf(err.Error())
+				t.Log(err.Error())
 			}
 			if got := stdout.String(); got != tt.wantStdout {
-				t.Logf(t.Name())
+				t.Log(t.Name())
 				t.Errorf("  stdout = %v, want %v", got, tt.wantStdout)
 			}
 			if got := stderr.String(); got != tt.wantStderr {
-				t.Logf(t.Name())
+				t.Log(t.Name())
 				t.Errorf("  stderr = %v, want %v", got, tt.wantStderr)
 			}
 
diff --git a/pkg/cmd/gist/edit/edit_test.go b/pkg/cmd/gist/edit/edit_test.go
index 728f6e894..11a32bc92 100644
--- a/pkg/cmd/gist/edit/edit_test.go
+++ b/pkg/cmd/gist/edit/edit_test.go
@@ -3,13 +3,11 @@ package edit
 import (
 	"bytes"
 	"encoding/json"
-	"fmt"
 	"io"
 	"net/http"
 	"os"
 	"path/filepath"
 	"testing"
-	"time"
 
 	"github.com/cli/cli/v2/internal/config"
 	"github.com/cli/cli/v2/internal/gh"
@@ -143,31 +141,23 @@ func Test_editRun(t *testing.T) {
 	require.NoError(t, err)
 
 	tests := []struct {
-		name                      string
-		opts                      *EditOptions
-		mockGist                  *shared.Gist
-		mockGistList              bool
-		httpStubs                 func(*httpmock.Registry)
-		prompterStubs             func(*prompter.MockPrompter)
-		isTTY                     bool
-		stdin                     string
-		wantErr                   string
-		wantLastRequestParameters map[string]interface{}
+		name          string
+		opts          *EditOptions
+		gist          *shared.Gist
+		httpStubs     func(*httpmock.Registry)
+		prompterStubs func(*prompter.MockPrompter)
+		nontty        bool
+		stdin         string
+		wantErr       string
+		wantParams    map[string]interface{}
 	}{
 		{
 			name:    "no such gist",
 			wantErr: "gist not found: 1234",
-			opts: &EditOptions{
-				Selector: "1234",
-			},
 		},
 		{
-			name:  "one file",
-			isTTY: false,
-			opts: &EditOptions{
-				Selector: "1234",
-			},
-			mockGist: &shared.Gist{
+			name: "one file",
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -182,7 +172,7 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"cicada.txt": map[string]interface{}{
@@ -193,9 +183,7 @@ func Test_editRun(t *testing.T) {
 			},
 		},
 		{
-			name:         "multiple files, submit, with TTY",
-			isTTY:        true,
-			mockGistList: true,
+			name: "multiple files, submit",
 			prompterStubs: func(pm *prompter.MockPrompter) {
 				pm.RegisterSelect("Edit which file?",
 					[]string{"cicada.txt", "unix.md"},
@@ -208,7 +196,7 @@ func Test_editRun(t *testing.T) {
 						return prompter.IndexFor(opts, "Submit")
 					})
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID:          "1234",
 				Description: "catbug",
 				Files: map[string]*shared.GistFile{
@@ -227,7 +215,7 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			wantParams: map[string]interface{}{
 				"description": "catbug",
 				"files": map[string]interface{}{
 					"cicada.txt": map[string]interface{}{
@@ -242,11 +230,7 @@ func Test_editRun(t *testing.T) {
 			},
 		},
 		{
-			name:  "multiple files, cancel, with TTY",
-			isTTY: true,
-			opts: &EditOptions{
-				Selector: "1234",
-			},
+			name: "multiple files, cancel",
 			prompterStubs: func(pm *prompter.MockPrompter) {
 				pm.RegisterSelect("Edit which file?",
 					[]string{"cicada.txt", "unix.md"},
@@ -260,7 +244,7 @@ func Test_editRun(t *testing.T) {
 					})
 			},
 			wantErr: "CancelError",
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -279,10 +263,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "not change",
-			opts: &EditOptions{
-				Selector: "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -296,10 +277,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "another user's gist",
-			opts: &EditOptions{
-				Selector: "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -314,11 +292,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "add file to existing gist",
-			opts: &EditOptions{
-				AddFilename: fileToAdd,
-				Selector:    "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -333,14 +307,16 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
+			opts: &EditOptions{
+				AddFilename: fileToAdd,
+			},
 		},
 		{
 			name: "change description",
 			opts: &EditOptions{
 				Description: "my new description",
-				Selector:    "1234",
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID:          "1234",
 				Description: "my old description",
 				Files: map[string]*shared.GistFile{
@@ -355,7 +331,7 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			wantParams: map[string]interface{}{
 				"description": "my new description",
 				"files": map[string]interface{}{
 					"sample.txt": map[string]interface{}{
@@ -367,12 +343,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "add file to existing gist from source parameter",
-			opts: &EditOptions{
-				AddFilename: "from_source.txt",
-				SourceFile:  fileToAdd,
-				Selector:    "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -387,7 +358,11 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			opts: &EditOptions{
+				AddFilename: "from_source.txt",
+				SourceFile:  fileToAdd,
+			},
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"from_source.txt": map[string]interface{}{
@@ -399,12 +374,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "add file to existing gist from stdin",
-			opts: &EditOptions{
-				AddFilename: "from_source.txt",
-				SourceFile:  "-",
-				Selector:    "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -419,8 +389,12 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
+			opts: &EditOptions{
+				AddFilename: "from_source.txt",
+				SourceFile:  "-",
+			},
 			stdin: "data from stdin",
-			wantLastRequestParameters: map[string]interface{}{
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"from_source.txt": map[string]interface{}{
@@ -432,11 +406,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "remove file, file does not exist",
-			opts: &EditOptions{
-				RemoveFilename: "sample2.txt",
-				Selector:       "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -447,15 +417,14 @@ func Test_editRun(t *testing.T) {
 				},
 				Owner: &shared.GistOwner{Login: "octocat"},
 			},
+			opts: &EditOptions{
+				RemoveFilename: "sample2.txt",
+			},
 			wantErr: "gist has no file \"sample2.txt\"",
 		},
 		{
 			name: "remove file from existing gist",
-			opts: &EditOptions{
-				RemoveFilename: "sample2.txt",
-				Selector:       "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -475,7 +444,10 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			opts: &EditOptions{
+				RemoveFilename: "sample2.txt",
+			},
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"sample.txt": map[string]interface{}{
@@ -488,11 +460,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "edit gist using file from source parameter",
-			opts: &EditOptions{
-				SourceFile: fileToAdd,
-				Selector:   "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -507,7 +475,10 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
-			wantLastRequestParameters: map[string]interface{}{
+			opts: &EditOptions{
+				SourceFile: fileToAdd,
+			},
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"sample.txt": map[string]interface{}{
@@ -519,11 +490,7 @@ func Test_editRun(t *testing.T) {
 		},
 		{
 			name: "edit gist using stdin",
-			opts: &EditOptions{
-				SourceFile: "-",
-				Selector:   "1234",
-			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				ID: "1234",
 				Files: map[string]*shared.GistFile{
 					"sample.txt": {
@@ -538,8 +505,11 @@ func Test_editRun(t *testing.T) {
 				reg.Register(httpmock.REST("POST", "gists/1234"),
 					httpmock.StatusStringResponse(201, "{}"))
 			},
+			opts: &EditOptions{
+				SourceFile: "-",
+			},
 			stdin: "data from stdin",
-			wantLastRequestParameters: map[string]interface{}{
+			wantParams: map[string]interface{}{
 				"description": "",
 				"files": map[string]interface{}{
 					"sample.txt": map[string]interface{}{
@@ -549,74 +519,28 @@ func Test_editRun(t *testing.T) {
 				},
 			},
 		},
-		{
-			name:  "no arguments notty",
-			isTTY: false,
-			opts: &EditOptions{
-				Selector: "",
-			},
-			wantErr: "gist ID or URL required when not running interactively",
-		},
 	}
 
 	for _, tt := range tests {
 		reg := &httpmock.Registry{}
-		pm := prompter.NewMockPrompter(t)
-
-		if tt.opts == nil {
-			tt.opts = &EditOptions{}
-		}
-
-		if tt.opts.Selector != "" {
-			// Only register the HTTP stubs for a direct gist lookup if a selector is provided.
-			if tt.mockGist == nil {
-				// If no gist is provided, we expect a 404.
-				reg.Register(httpmock.REST("GET", fmt.Sprintf("gists/%s", tt.opts.Selector)),
-					httpmock.StatusStringResponse(404, "Not Found"))
-			} else {
-				// If a gist is provided, we expect the gist to be fetched.
-				reg.Register(httpmock.REST("GET", fmt.Sprintf("gists/%s", tt.opts.Selector)),
-					httpmock.JSONResponse(tt.mockGist))
-				reg.Register(httpmock.GraphQL(`query UserCurrent\b`),
-					httpmock.StringResponse(`{"data":{"viewer":{"login":"octocat"}}}`))
-			}
-		}
-
-		if tt.mockGistList {
-			sixHours, _ := time.ParseDuration("6h")
-			sixHoursAgo := time.Now().Add(-sixHours)
-			reg.Register(httpmock.GraphQL(`query GistList\b`),
-				httpmock.StringResponse(
-					fmt.Sprintf(`{ "data": { "viewer": { "gists": { "nodes": [
-							{
-								"description": "whatever",
-								"files": [{ "name": "cicada.txt" }, { "name": "unix.md"	}],
-								"isPublic": true,
-								"name": "1234",
-								"updatedAt": "%s"
-							}
-							],
-							"pageInfo": {
-								"hasNextPage": false,
-								"endCursor": "somevaluedoesnotmatter"
-							} }	} }	}`, sixHoursAgo.Format(time.RFC3339))))
+		if tt.gist == nil {
+			reg.Register(httpmock.REST("GET", "gists/1234"),
+				httpmock.StatusStringResponse(404, "Not Found"))
+		} else {
 			reg.Register(httpmock.REST("GET", "gists/1234"),
-				httpmock.JSONResponse(tt.mockGist))
+				httpmock.JSONResponse(tt.gist))
 			reg.Register(httpmock.GraphQL(`query UserCurrent\b`),
 				httpmock.StringResponse(`{"data":{"viewer":{"login":"octocat"}}}`))
-
-			gistList := "cicada.txt whatever about 6 hours ago"
-			pm.RegisterSelect("Select a gist",
-				[]string{gistList},
-				func(_, _ string, opts []string) (int, error) {
-					return prompter.IndexFor(opts, gistList)
-				})
 		}
 
 		if tt.httpStubs != nil {
 			tt.httpStubs(reg)
 		}
 
+		if tt.opts == nil {
+			tt.opts = &EditOptions{}
+		}
+
 		tt.opts.Edit = func(_, _, _ string, _ *iostreams.IOStreams) (string, error) {
 			return "new file content", nil
 		}
@@ -626,17 +550,17 @@ func Test_editRun(t *testing.T) {
 		}
 		ios, stdin, stdout, stderr := iostreams.Test()
 		stdin.WriteString(tt.stdin)
-		ios.SetStdoutTTY(tt.isTTY)
-		ios.SetStdinTTY(tt.isTTY)
-		ios.SetStderrTTY(tt.isTTY)
-
+		ios.SetStdoutTTY(!tt.nontty)
+		ios.SetStdinTTY(!tt.nontty)
 		tt.opts.IO = ios
+		tt.opts.Selector = "1234"
 
 		tt.opts.Config = func() (gh.Config, error) {
 			return config.NewBlankConfig(), nil
 		}
 
 		t.Run(tt.name, func(t *testing.T) {
+			pm := prompter.NewMockPrompter(t)
 			if tt.prompterStubs != nil {
 				tt.prompterStubs(pm)
 			}
@@ -650,21 +574,14 @@ func Test_editRun(t *testing.T) {
 			}
 			assert.NoError(t, err)
 
-			if tt.wantLastRequestParameters != nil {
-				// Currently only checking that the last request has
-				// the expected request parameters.
-				//
-				// This might need to be changed, if a test were to be added
-				// that needed to check that a request other than the last
-				// has the desired parameters.
-				lastRequest := reg.Requests[len(reg.Requests)-1]
-				bodyBytes, _ := io.ReadAll(lastRequest.Body)
+			if tt.wantParams != nil {
+				bodyBytes, _ := io.ReadAll(reg.Requests[2].Body)
 				reqBody := make(map[string]interface{})
 				err = json.Unmarshal(bodyBytes, &reqBody)
 				if err != nil {
 					t.Fatalf("error decoding JSON: %v", err)
 				}
-				assert.Equal(t, tt.wantLastRequestParameters, reqBody)
+				assert.Equal(t, tt.wantParams, reqBody)
 			}
 
 			assert.Equal(t, "", stdout.String())
diff --git a/pkg/cmd/gist/view/view_test.go b/pkg/cmd/gist/view/view_test.go
index 706b85f10..52e616f7c 100644
--- a/pkg/cmd/gist/view/view_test.go
+++ b/pkg/cmd/gist/view/view_test.go
@@ -16,7 +16,6 @@ import (
 	"github.com/cli/cli/v2/pkg/iostreams"
 	"github.com/google/shlex"
 	"github.com/stretchr/testify/assert"
-	"github.com/stretchr/testify/require"
 )
 
 func TestNewCmdView(t *testing.T) {
@@ -95,7 +94,6 @@ func TestNewCmdView(t *testing.T) {
 				gotOpts = opts
 				return nil
 			})
-
 			cmd.SetArgs(argv)
 			cmd.SetIn(&bytes.Buffer{})
 			cmd.SetOut(&bytes.Buffer{})
@@ -116,28 +114,25 @@ func Test_viewRun(t *testing.T) {
 		name         string
 		opts         *ViewOptions
 		wantOut      string
-		mockGist     *shared.Gist
+		gist         *shared.Gist
+		wantErr      bool
 		mockGistList bool
-		isTTY        bool
-		wantErr      string
 	}{
 		{
-			name:  "no such gist",
-			isTTY: false,
+			name: "no such gist",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				ListFiles: false,
 			},
-			wantErr: "not found",
+			wantErr: true,
 		},
 		{
-			name:  "one file",
-			isTTY: true,
+			name: "one file",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "bwhiizzzbwhuiiizzzz",
@@ -148,14 +143,13 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "bwhiizzzbwhuiiizzzz\n",
 		},
 		{
-			name:  "one file, no ID supplied",
-			isTTY: true,
+			name: "one file, no ID supplied",
 			opts: &ViewOptions{
 				Selector:  "",
 				ListFiles: false,
 			},
 			mockGistList: true,
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "test interactive mode",
@@ -166,19 +160,13 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "test interactive mode\n",
 		},
 		{
-			name:    "no arguments notty",
-			isTTY:   false,
-			wantErr: "gist ID or URL required when not running interactively",
-		},
-		{
-			name:  "filename selected",
-			isTTY: true,
+			name: "filename selected",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				Filename:  "cicada.txt",
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "bwhiizzzbwhuiiizzzz",
@@ -193,15 +181,14 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "bwhiizzzbwhuiiizzzz\n",
 		},
 		{
-			name:  "filename selected, raw",
-			isTTY: true,
+			name: "filename selected, raw",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				Filename:  "cicada.txt",
 				Raw:       true,
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "bwhiizzzbwhuiiizzzz",
@@ -216,13 +203,12 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "bwhiizzzbwhuiiizzzz\n",
 		},
 		{
-			name:  "multiple files, no description",
-			isTTY: true,
+			name: "multiple files, no description",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "bwhiizzzbwhuiiizzzz",
@@ -237,13 +223,12 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "cicada.txt\n\nbwhiizzzbwhuiiizzzz\n\nfoo.md\n\n\n  # foo                                                                       \n\n",
 		},
 		{
-			name:  "multiple files, trailing newlines",
-			isTTY: true,
+			name: "multiple files, trailing newlines",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
 						Content: "bwhiizzzbwhuiiizzzz\n",
@@ -258,13 +243,12 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "cicada.txt\n\nbwhiizzzbwhuiiizzzz\n\nfoo.txt\n\nbar\n",
 		},
 		{
-			name:  "multiple files, description",
-			isTTY: true,
+			name: "multiple files, description",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Description: "some files",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -280,14 +264,13 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "some files\n\ncicada.txt\n\nbwhiizzzbwhuiiizzzz\n\nfoo.md\n\n\n                                                                              \n  • foo                                                                       \n\n",
 		},
 		{
-			name:  "multiple files, raw",
-			isTTY: true,
+			name: "multiple files, raw",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				Raw:       true,
 				ListFiles: false,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Description: "some files",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -303,14 +286,13 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "some files\n\ncicada.txt\n\nbwhiizzzbwhuiiizzzz\n\nfoo.md\n\n- foo\n",
 		},
 		{
-			name:  "one file, list files",
-			isTTY: true,
+			name: "one file, list files",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				Raw:       false,
 				ListFiles: true,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Description: "some files",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -322,14 +304,13 @@ func Test_viewRun(t *testing.T) {
 			wantOut: "cicada.txt\n",
 		},
 		{
-			name:  "multiple file, list files",
-			isTTY: true,
+			name: "multiple file, list files",
 			opts: &ViewOptions{
 				Selector:  "1234",
 				Raw:       false,
 				ListFiles: true,
 			},
-			mockGist: &shared.Gist{
+			gist: &shared.Gist{
 				Description: "some files",
 				Files: map[string]*shared.GistFile{
 					"cicada.txt": {
@@ -348,12 +329,12 @@ func Test_viewRun(t *testing.T) {
 
 	for _, tt := range tests {
 		reg := &httpmock.Registry{}
-		if tt.mockGist == nil {
+		if tt.gist == nil {
 			reg.Register(httpmock.REST("GET", "gists/1234"),
 				httpmock.StatusStringResponse(404, "Not Found"))
 		} else {
 			reg.Register(httpmock.REST("GET", "gists/1234"),
-				httpmock.JSONResponse(tt.mockGist))
+				httpmock.JSONResponse(tt.gist))
 		}
 
 		if tt.opts == nil {
@@ -395,20 +376,16 @@ func Test_viewRun(t *testing.T) {
 		}
 
 		ios, _, stdout, _ := iostreams.Test()
-		ios.SetStdoutTTY(tt.isTTY)
-		ios.SetStdinTTY(tt.isTTY)
-		ios.SetStderrTTY(tt.isTTY)
-
+		ios.SetStdoutTTY(true)
 		tt.opts.IO = ios
 
 		t.Run(tt.name, func(t *testing.T) {
 			err := viewRun(tt.opts)
-			if tt.wantErr != "" {
-				require.EqualError(t, err, tt.wantErr)
+			if tt.wantErr {
+				assert.Error(t, err)
 				return
-			} else {
-				require.NoError(t, err)
 			}
+			assert.NoError(t, err)
 
 			assert.Equal(t, tt.wantOut, stdout.String())
 			reg.Verify(t)
diff --git a/pkg/cmd/repo/setdefault/setdefault_test.go b/pkg/cmd/repo/setdefault/setdefault_test.go
index dfd72d83e..55a0193d5 100644
--- a/pkg/cmd/repo/setdefault/setdefault_test.go
+++ b/pkg/cmd/repo/setdefault/setdefault_test.go
@@ -382,7 +382,7 @@ func TestDefaultRun(t *testing.T) {
 					}
 				}
 			},
-			wantStdout: "This command sets the default remote repository to use when querying the\nGitHub API for the locally cloned repository.\n\ngh uses the default repository for things like:\n\n - viewing and creating pull requests\n - viewing and creating issues\n - viewing and creating releases\n - working with GitHub Actions\n\n### NOTE: gh does not use the default repository for managing repository and environment secrets.\n\n✓ Set OWNER2/REPO2 as the default repository for the current directory\n",
+			wantStdout: "This command sets the default remote repository to use when querying the\nGitHub API for the locally cloned repository.\n\ngh uses the default repository for things like:\n\n - viewing and creating pull requests\n - viewing and creating issues\n - viewing and creating releases\n - working with GitHub Actions\n - adding repository and environment secrets\n\n✓ Set OWNER2/REPO2 as the default repository for the current directory\n",
 		},
 		{
 			name: "interactive mode only one known host",
@@ -456,7 +456,7 @@ func TestDefaultRun(t *testing.T) {
 					}
 				}
 			},
-			wantStdout: "This command sets the default remote repository to use when querying the\nGitHub API for the locally cloned repository.\n\ngh uses the default repository for things like:\n\n - viewing and creating pull requests\n - viewing and creating issues\n - viewing and creating releases\n - working with GitHub Actions\n\n### NOTE: gh does not use the default repository for managing repository and environment secrets.\n\n✓ Set OWNER2/REPO2 as the default repository for the current directory\n",
+			wantStdout: "This command sets the default remote repository to use when querying the\nGitHub API for the locally cloned repository.\n\ngh uses the default repository for things like:\n\n - viewing and creating pull requests\n - viewing and creating issues\n - viewing and creating releases\n - working with GitHub Actions\n - adding repository and environment secrets\n\n✓ Set OWNER2/REPO2 as the default repository for the current directory\n",
 		},
 	}
 
diff --git a/pkg/cmd/secret/delete/delete_test.go b/pkg/cmd/secret/delete/delete_test.go
index 377879cf2..bd5053f4d 100644
--- a/pkg/cmd/secret/delete/delete_test.go
+++ b/pkg/cmd/secret/delete/delete_test.go
@@ -2,17 +2,12 @@ package delete
 
 import (
 	"bytes"
-	"io"
 	"net/http"
 	"testing"
 
-	ghContext "github.com/cli/cli/v2/context"
-	"github.com/cli/cli/v2/git"
 	"github.com/cli/cli/v2/internal/config"
 	"github.com/cli/cli/v2/internal/gh"
 	"github.com/cli/cli/v2/internal/ghrepo"
-	"github.com/cli/cli/v2/internal/prompter"
-	"github.com/cli/cli/v2/pkg/cmd/secret/shared"
 	"github.com/cli/cli/v2/pkg/cmdutil"
 	"github.com/cli/cli/v2/pkg/httpmock"
 	"github.com/cli/cli/v2/pkg/iostreams"
@@ -125,108 +120,6 @@ func TestNewCmdDelete(t *testing.T) {
 	}
 }
 
-func TestNewCmdDeleteBaseRepoFuncs(t *testing.T) {
-	remotes := ghContext.Remotes{
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "origin",
-			},
-			Repo: ghrepo.New("owner", "fork"),
-		},
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "upstream",
-			},
-			Repo: ghrepo.New("owner", "repo"),
-		},
-	}
-
-	tests := []struct {
-		name          string
-		args          string
-		prompterStubs func(*prompter.MockPrompter)
-		wantRepo      ghrepo.Interface
-		wantErr       error
-	}{
-		{
-			name:     "when there is a repo flag provided, the factory base repo func is used",
-			args:     "SECRET_NAME --repo owner/repo",
-			wantRepo: ghrepo.New("owner", "repo"),
-		},
-		{
-			name: "when there is no repo flag provided, and no prompting, the base func requiring no ambiguity is used",
-			args: "SECRET_NAME",
-			wantErr: shared.AmbiguousBaseRepoError{
-				Remotes: remotes,
-			},
-		},
-		{
-			name: "when there is no repo flag provided, and can prompt, the base func resolving ambiguity is used",
-			args: "SECRET_NAME",
-			prompterStubs: func(pm *prompter.MockPrompter) {
-				pm.RegisterSelect(
-					"Select a repo",
-					[]string{"owner/fork", "owner/repo"},
-					func(_, _ string, opts []string) (int, error) {
-						return prompter.IndexFor(opts, "owner/fork")
-					},
-				)
-			},
-			wantRepo: ghrepo.New("owner", "fork"),
-		},
-	}
-
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			ios, _, _, _ := iostreams.Test()
-			var pm *prompter.MockPrompter
-			if tt.prompterStubs != nil {
-				ios.SetStdinTTY(true)
-				ios.SetStdoutTTY(true)
-				ios.SetStderrTTY(true)
-				pm = prompter.NewMockPrompter(t)
-				tt.prompterStubs(pm)
-			}
-
-			f := &cmdutil.Factory{
-				IOStreams: ios,
-				BaseRepo: func() (ghrepo.Interface, error) {
-					return ghrepo.FromFullName("owner/repo")
-				},
-				Prompter: pm,
-				Remotes: func() (ghContext.Remotes, error) {
-					return remotes, nil
-				},
-			}
-
-			argv, err := shlex.Split(tt.args)
-			assert.NoError(t, err)
-
-			var gotOpts *DeleteOptions
-			cmd := NewCmdDelete(f, func(opts *DeleteOptions) error {
-				gotOpts = opts
-				return nil
-			})
-			// Require to support --repo flag
-			cmdutil.EnableRepoOverride(cmd, f)
-			cmd.SetArgs(argv)
-			cmd.SetIn(&bytes.Buffer{})
-			cmd.SetOut(io.Discard)
-			cmd.SetErr(io.Discard)
-
-			_, err = cmd.ExecuteC()
-			require.NoError(t, err)
-
-			baseRepo, err := gotOpts.BaseRepo()
-			if tt.wantErr != nil {
-				require.Equal(t, tt.wantErr, err)
-				return
-			}
-			require.True(t, ghrepo.IsSame(tt.wantRepo, baseRepo))
-		})
-	}
-}
-
 func Test_removeRun_repo(t *testing.T) {
 	tests := []struct {
 		name      string
diff --git a/pkg/cmd/secret/list/list_test.go b/pkg/cmd/secret/list/list_test.go
index 601de2572..2e7b19065 100644
--- a/pkg/cmd/secret/list/list_test.go
+++ b/pkg/cmd/secret/list/list_test.go
@@ -3,19 +3,15 @@ package list
 import (
 	"bytes"
 	"fmt"
-	"io"
 	"net/http"
 	"net/url"
 	"strings"
 	"testing"
 	"time"
 
-	ghContext "github.com/cli/cli/v2/context"
-	"github.com/cli/cli/v2/git"
 	"github.com/cli/cli/v2/internal/config"
 	"github.com/cli/cli/v2/internal/gh"
 	"github.com/cli/cli/v2/internal/ghrepo"
-	"github.com/cli/cli/v2/internal/prompter"
 	"github.com/cli/cli/v2/pkg/cmd/secret/shared"
 	"github.com/cli/cli/v2/pkg/cmdutil"
 	"github.com/cli/cli/v2/pkg/httpmock"
@@ -105,108 +101,6 @@ func Test_NewCmdList(t *testing.T) {
 	}
 }
 
-func TestNewCmdListBaseRepoFuncs(t *testing.T) {
-	remotes := ghContext.Remotes{
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "origin",
-			},
-			Repo: ghrepo.New("owner", "fork"),
-		},
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "upstream",
-			},
-			Repo: ghrepo.New("owner", "repo"),
-		},
-	}
-
-	tests := []struct {
-		name          string
-		args          string
-		prompterStubs func(*prompter.MockPrompter)
-		wantRepo      ghrepo.Interface
-		wantErr       error
-	}{
-		{
-			name:     "when there is a repo flag provided, the factory base repo func is used",
-			args:     "--repo owner/repo",
-			wantRepo: ghrepo.New("owner", "repo"),
-		},
-		{
-			name: "when there is no repo flag provided, and no prompting, the base func requiring no ambiguity is used",
-			args: "",
-			wantErr: shared.AmbiguousBaseRepoError{
-				Remotes: remotes,
-			},
-		},
-		{
-			name: "when there is no repo flag provided, and can prompt, the base func resolving ambiguity is used",
-			args: "",
-			prompterStubs: func(pm *prompter.MockPrompter) {
-				pm.RegisterSelect(
-					"Select a repo",
-					[]string{"owner/fork", "owner/repo"},
-					func(_, _ string, opts []string) (int, error) {
-						return prompter.IndexFor(opts, "owner/fork")
-					},
-				)
-			},
-			wantRepo: ghrepo.New("owner", "fork"),
-		},
-	}
-
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			ios, _, _, _ := iostreams.Test()
-			var pm *prompter.MockPrompter
-			if tt.prompterStubs != nil {
-				ios.SetStdinTTY(true)
-				ios.SetStdoutTTY(true)
-				ios.SetStderrTTY(true)
-				pm = prompter.NewMockPrompter(t)
-				tt.prompterStubs(pm)
-			}
-
-			f := &cmdutil.Factory{
-				IOStreams: ios,
-				BaseRepo: func() (ghrepo.Interface, error) {
-					return ghrepo.FromFullName("owner/repo")
-				},
-				Prompter: pm,
-				Remotes: func() (ghContext.Remotes, error) {
-					return remotes, nil
-				},
-			}
-
-			argv, err := shlex.Split(tt.args)
-			assert.NoError(t, err)
-
-			var gotOpts *ListOptions
-			cmd := NewCmdList(f, func(opts *ListOptions) error {
-				gotOpts = opts
-				return nil
-			})
-			// Require to support --repo flag
-			cmdutil.EnableRepoOverride(cmd, f)
-			cmd.SetArgs(argv)
-			cmd.SetIn(&bytes.Buffer{})
-			cmd.SetOut(io.Discard)
-			cmd.SetErr(io.Discard)
-
-			_, err = cmd.ExecuteC()
-			require.NoError(t, err)
-
-			baseRepo, err := gotOpts.BaseRepo()
-			if tt.wantErr != nil {
-				require.Equal(t, tt.wantErr, err)
-				return
-			}
-			require.True(t, ghrepo.IsSame(tt.wantRepo, baseRepo))
-		})
-	}
-}
-
 func Test_listRun(t *testing.T) {
 	tests := []struct {
 		name    string
diff --git a/pkg/cmd/secret/set/set_test.go b/pkg/cmd/secret/set/set_test.go
index 99c8c6cbe..5c8d6f693 100644
--- a/pkg/cmd/secret/set/set_test.go
+++ b/pkg/cmd/secret/set/set_test.go
@@ -10,8 +10,6 @@ import (
 	"testing"
 
 	"github.com/MakeNowJust/heredoc"
-	ghContext "github.com/cli/cli/v2/context"
-	"github.com/cli/cli/v2/git"
 	"github.com/cli/cli/v2/internal/config"
 	"github.com/cli/cli/v2/internal/gh"
 	"github.com/cli/cli/v2/internal/ghrepo"
@@ -22,7 +20,6 @@ import (
 	"github.com/cli/cli/v2/pkg/iostreams"
 	"github.com/google/shlex"
 	"github.com/stretchr/testify/assert"
-	"github.com/stretchr/testify/require"
 )
 
 func TestNewCmdSet(t *testing.T) {
@@ -224,108 +221,6 @@ func TestNewCmdSet(t *testing.T) {
 	}
 }
 
-func TestNewCmdSetBaseRepoFuncs(t *testing.T) {
-	remotes := ghContext.Remotes{
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "origin",
-			},
-			Repo: ghrepo.New("owner", "fork"),
-		},
-		&ghContext.Remote{
-			Remote: &git.Remote{
-				Name: "upstream",
-			},
-			Repo: ghrepo.New("owner", "repo"),
-		},
-	}
-
-	tests := []struct {
-		name          string
-		args          string
-		prompterStubs func(*prompter.MockPrompter)
-		wantRepo      ghrepo.Interface
-		wantErr       error
-	}{
-		{
-			name:     "when there is a repo flag provided, the factory base repo func is used",
-			args:     "SECRET_NAME --repo owner/repo",
-			wantRepo: ghrepo.New("owner", "repo"),
-		},
-		{
-			name: "when there is no repo flag provided, and no prompting, the base func requiring no ambiguity is used",
-			args: "SECRET_NAME",
-			wantErr: shared.AmbiguousBaseRepoError{
-				Remotes: remotes,
-			},
-		},
-		{
-			name: "when there is no repo flag provided, and can prompt, the base func resolving ambiguity is used",
-			args: "SECRET_NAME",
-			prompterStubs: func(pm *prompter.MockPrompter) {
-				pm.RegisterSelect(
-					"Select a repo",
-					[]string{"owner/fork", "owner/repo"},
-					func(_, _ string, opts []string) (int, error) {
-						return prompter.IndexFor(opts, "owner/fork")
-					},
-				)
-			},
-			wantRepo: ghrepo.New("owner", "fork"),
-		},
-	}
-
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			ios, _, _, _ := iostreams.Test()
-			var pm *prompter.MockPrompter
-			if tt.prompterStubs != nil {
-				ios.SetStdinTTY(true)
-				ios.SetStdoutTTY(true)
-				ios.SetStderrTTY(true)
-				pm = prompter.NewMockPrompter(t)
-				tt.prompterStubs(pm)
-			}
-
-			f := &cmdutil.Factory{
-				IOStreams: ios,
-				BaseRepo: func() (ghrepo.Interface, error) {
-					return ghrepo.FromFullName("owner/repo")
-				},
-				Prompter: pm,
-				Remotes: func() (ghContext.Remotes, error) {
-					return remotes, nil
-				},
-			}
-
-			argv, err := shlex.Split(tt.args)
-			assert.NoError(t, err)
-
-			var gotOpts *SetOptions
-			cmd := NewCmdSet(f, func(opts *SetOptions) error {
-				gotOpts = opts
-				return nil
-			})
-			// Require to support --repo flag
-			cmdutil.EnableRepoOverride(cmd, f)
-			cmd.SetArgs(argv)
-			cmd.SetIn(&bytes.Buffer{})
-			cmd.SetOut(io.Discard)
-			cmd.SetErr(io.Discard)
-
-			_, err = cmd.ExecuteC()
-			require.NoError(t, err)
-
-			baseRepo, err := gotOpts.BaseRepo()
-			if tt.wantErr != nil {
-				require.Equal(t, tt.wantErr, err)
-				return
-			}
-			require.True(t, ghrepo.IsSame(tt.wantRepo, baseRepo))
-		})
-	}
-}
-
 func Test_setRun_repo(t *testing.T) {
 	tests := []struct {
 		name    string
diff --git a/pkg/cmd/secret/shared/base_repo_test.go b/pkg/cmd/secret/shared/base_repo_test.go
deleted file mode 100644
index d78fad7e5..000000000
--- a/pkg/cmd/secret/shared/base_repo_test.go
+++ /dev/null
@@ -1,249 +0,0 @@
-package shared_test
-
-import (
-	"errors"
-	"testing"
-
-	ghContext "github.com/cli/cli/v2/context"
-	"github.com/cli/cli/v2/pkg/cmd/secret/shared"
-	"github.com/cli/cli/v2/pkg/iostreams"
-	"github.com/stretchr/testify/require"
-
-	"github.com/cli/cli/v2/git"
-	"github.com/cli/cli/v2/internal/ghrepo"
-	"github.com/cli/cli/v2/internal/prompter"
-)
-
-func TestRequireNoAmbiguityBaseRepoFunc(t *testing.T) {
-	t.Parallel()
-
-	t.Run("succeeds when there is only one remote", func(t *testing.T) {
-		t.Parallel()
-
-		// Given there is only one remote
-		baseRepoFn := shared.RequireNoAmbiguityBaseRepoFunc(baseRepoStubFn, oneRemoteStubFn)
-
-		// When fetching the base repo
-		baseRepo, err := baseRepoFn()
-
-		// It succeeds and returns the inner base repo
-		require.NoError(t, err)
-		require.True(t, ghrepo.IsSame(ghrepo.New("owner", "repo"), baseRepo))
-	})
-
-	t.Run("returns specific error when there are multiple remotes", func(t *testing.T) {
-		t.Parallel()
-
-		// Given there are multiple remotes
-		baseRepoFn := shared.RequireNoAmbiguityBaseRepoFunc(baseRepoStubFn, twoRemotesStubFn)
-
-		// When fetching the base repo
-		_, err := baseRepoFn()
-
-		// It succeeds and returns the inner base repo
-		var multipleRemotesError shared.AmbiguousBaseRepoError
-		require.ErrorAs(t, err, &multipleRemotesError)
-		require.Equal(t, ghContext.Remotes{
-			{
-				Remote: &git.Remote{
-					Name: "origin",
-				},
-				Repo: ghrepo.New("owner", "fork"),
-			},
-			{
-				Remote: &git.Remote{
-					Name: "upstream",
-				},
-				Repo: ghrepo.New("owner", "repo"),
-			},
-		}, multipleRemotesError.Remotes)
-	})
-
-	t.Run("when the remote fetching function fails, it returns the error", func(t *testing.T) {
-		t.Parallel()
-
-		// Given the remote fetching function fails
-		baseRepoFn := shared.RequireNoAmbiguityBaseRepoFunc(baseRepoStubFn, errRemoteStubFn)
-
-		// When fetching the base repo
-		_, err := baseRepoFn()
-
-		// It returns the error
-		require.Equal(t, errors.New("test remote error"), err)
-	})
-
-	t.Run("when the wrapped base repo function fails, it returns the error", func(t *testing.T) {
-		t.Parallel()
-
-		// Given the wrapped base repo function fails
-		baseRepoFn := shared.RequireNoAmbiguityBaseRepoFunc(errBaseRepoStubFn, oneRemoteStubFn)
-
-		// When fetching the base repo
-		_, err := baseRepoFn()
-
-		// It returns the error
-		require.Equal(t, errors.New("test base repo error"), err)
-	})
-}
-
-func TestPromptWhenMultipleRemotesBaseRepoFunc(t *testing.T) {
-	t.Parallel()
-
-	t.Run("when there is no error from wrapped base repo func, then it succeeds without prompting", func(t *testing.T) {
-		t.Parallel()
-
-		ios, _, _, _ := iostreams.Test()
-
-		// Given the base repo function succeeds
-		baseRepoFn := shared.PromptWhenAmbiguousBaseRepoFunc(baseRepoStubFn, ios, nil)
-
-		// When fetching the base repo
-		baseRepo, err := baseRepoFn()
-
-		// It succeeds and returns the inner base repo
-		require.NoError(t, err)
-		require.True(t, ghrepo.IsSame(ghrepo.New("owner", "repo"), baseRepo))
-	})
-
-	t.Run("when the wrapped base repo func returns a specific error, then the prompter is used for disambiguation, with the remote ordering remaining unchanged", func(t *testing.T) {
-		t.Parallel()
-
-		ios, _, stdout, _ := iostreams.Test()
-
-		pm := prompter.NewMockPrompter(t)
-		pm.RegisterSelect(
-			"Select a repo",
-			[]string{"owner/fork", "owner/repo"},
-			func(_, def string, opts []string) (int, error) {
-				require.Equal(t, "owner/fork", def)
-				return prompter.IndexFor(opts, "owner/repo")
-			},
-		)
-
-		// Given the wrapped base repo func returns a specific error
-		baseRepoFn := shared.PromptWhenAmbiguousBaseRepoFunc(errMultipleRemotesStubFn, ios, pm)
-
-		// When fetching the base repo
-		baseRepo, err := baseRepoFn()
-
-		// It prints an informative message
-		require.Equal(t, "! Multiple remotes detected. Due to the sensitive nature of secrets, requiring disambiguation.\n", stdout.String())
-
-		// And it uses the prompter for disambiguation
-		require.NoError(t, err)
-		require.True(t, ghrepo.IsSame(ghrepo.New("owner", "repo"), baseRepo))
-	})
-
-	t.Run("when the prompter returns an error, then it is returned", func(t *testing.T) {
-		t.Parallel()
-
-		ios, _, _, _ := iostreams.Test()
-
-		// Given the prompter returns an error
-		pm := prompter.NewMockPrompter(t)
-		pm.RegisterSelect(
-			"Select a repo",
-			[]string{"owner/fork", "owner/repo"},
-			func(_, _ string, opts []string) (int, error) {
-				return 0, errors.New("test prompt error")
-			},
-		)
-
-		// Given the wrapped base repo func returns a specific error
-		baseRepoFn := shared.PromptWhenAmbiguousBaseRepoFunc(errMultipleRemotesStubFn, ios, pm)
-
-		// When fetching the base repo
-		_, err := baseRepoFn()
-
-		// It returns the error
-		require.Equal(t, errors.New("test prompt error"), err)
-	})
-
-	t.Run("when the wrapped base repo func returns a non-specific error, then it is returned", func(t *testing.T) {
-		t.Parallel()
-
-		ios, _, _, _ := iostreams.Test()
-
-		// Given the wrapped base repo func returns a non-specific error
-		baseRepoFn := shared.PromptWhenAmbiguousBaseRepoFunc(errBaseRepoStubFn, ios, nil)
-
-		// When fetching the base repo
-		_, err := baseRepoFn()
-
-		// It returns the error
-		require.Equal(t, errors.New("test base repo error"), err)
-	})
-}
-
-func TestMultipleRemotesErrorMessage(t *testing.T) {
-	err := shared.AmbiguousBaseRepoError{}
-	require.EqualError(t, err, "multiple remotes detected. please specify which repo to use by providing the -R, --repo argument")
-}
-
-func errMultipleRemotesStubFn() (ghrepo.Interface, error) {
-	remote1 := &ghContext.Remote{
-		Remote: &git.Remote{
-			Name: "origin",
-		},
-		Repo: ghrepo.New("owner", "fork"),
-	}
-
-	remote2 := &ghContext.Remote{
-		Remote: &git.Remote{
-			Name: "upstream",
-		},
-		Repo: ghrepo.New("owner", "repo"),
-	}
-
-	return nil, shared.AmbiguousBaseRepoError{
-		Remotes: ghContext.Remotes{
-			remote1,
-			remote2,
-		},
-	}
-}
-
-func baseRepoStubFn() (ghrepo.Interface, error) {
-	return ghrepo.New("owner", "repo"), nil
-}
-
-func oneRemoteStubFn() (ghContext.Remotes, error) {
-	remote := &ghContext.Remote{
-		Remote: &git.Remote{
-			Name: "origin",
-		},
-		Repo: ghrepo.New("owner", "repo"),
-	}
-
-	return ghContext.Remotes{
-		remote,
-	}, nil
-}
-
-func twoRemotesStubFn() (ghContext.Remotes, error) {
-	remote1 := &ghContext.Remote{
-		Remote: &git.Remote{
-			Name: "origin",
-		},
-		Repo: ghrepo.New("owner", "fork"),
-	}
-
-	remote2 := &ghContext.Remote{
-		Remote: &git.Remote{
-			Name: "upstream",
-		},
-		Repo: ghrepo.New("owner", "repo"),
-	}
-	return ghContext.Remotes{
-		remote1,
-		remote2,
-	}, nil
-}
-
-func errRemoteStubFn() (ghContext.Remotes, error) {
-	return nil, errors.New("test remote error")
-}
-
-func errBaseRepoStubFn() (ghrepo.Interface, error) {
-	return nil, errors.New("test base repo error")
-}