diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-13 15:45:47 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-01-14 09:46:55 +0300 |
commit | de2299abf00b263eb478f17ddd6bbbef861578df (patch) | |
tree | b1da6ca8adc9f2675657480b8b937b64acc059e5 | |
parent | 66dc5f887a93f029df221921ccde6b8d56660f9d (diff) |
git: Drop unused SafeCmdWithoutRepo() function
The `git.SafeCmdWithoutRepo()` function is not used anymore, so let's
drop it.
-rw-r--r-- | internal/git/safecmd.go | 21 | ||||
-rw-r--r-- | internal/git/safecmd_test.go | 4 |
2 files changed, 0 insertions, 25 deletions
diff --git a/internal/git/safecmd.go b/internal/git/safecmd.go index 85adbc405..fa5c8dd88 100644 --- a/internal/git/safecmd.go +++ b/internal/git/safecmd.go @@ -436,27 +436,6 @@ func SafeStdinCmd(ctx context.Context, repo repository.GitRepo, globals []Global return NewCommandFactory().unsafeStdinCmd(ctx, cc.env, repo, args...) } -// SafeCmdWithoutRepo works like Command but without a git repository. It -// validates the arguments in the command before executing. -func SafeCmdWithoutRepo(ctx context.Context, globals []GlobalOption, sc Cmd, opts ...CmdOpt) (*command.Command, error) { - cc := &cmdCfg{} - - if err := handleOpts(ctx, sc, cc, opts); err != nil { - return nil, err - } - - args, err := combineArgs(globals, sc, cc) - if err != nil { - return nil, err - } - - return NewCommandFactory().unsafeBareCmd(ctx, cmdStream{ - In: cc.stdin, - Out: cc.stdout, - Err: cc.stderr, - }, cc.env, args...) -} - func combineArgs(globals []GlobalOption, sc Cmd, cc *cmdCfg) (_ []string, err error) { var args []string diff --git a/internal/git/safecmd_test.go b/internal/git/safecmd_test.go index 7981b4f56..f629ca728 100644 --- a/internal/git/safecmd_test.go +++ b/internal/git/safecmd_test.go @@ -349,10 +349,6 @@ func TestSafeCmdValid(t *testing.T) { // ignore first indeterministic arg (executable path) require.Equal(t, tt.expectArgs, cmd.Args()[1:]) - cmd, err = SafeCmdWithoutRepo(ctx, tt.globals, tt.subCmd, opts...) - require.NoError(t, err) - require.Equal(t, tt.expectArgs, cmd.Args()[1:]) - cmd, err = SafeBareCmdInDir(ctx, testRepoPath, tt.globals, tt.subCmd, opts...) require.NoError(t, err) require.Equal(t, tt.expectArgs, cmd.Args()[1:]) |