diff options
author | John Cai <jcai@gitlab.com> | 2019-10-06 00:43:15 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2019-10-06 00:43:15 +0300 |
commit | 3a26cd4aa9c043fe33c8c86b309d20baae1a3155 (patch) | |
tree | 68c239de51c21378bdd9077e382627c811aab520 | |
parent | 1a0a149c8cb4232d6d5faab9b39faee686315337 (diff) | |
parent | 97e04d72191bcdc94e4df285a45313668c59b91a (diff) |
Merge branch 'zj-safe-git-dsl-git-remote' into 'master'
Use git.SafeCmd for the remote package
Closes #1946 and #1945
See merge request gitlab-org/gitaly!1534
-rw-r--r-- | internal/git/remote/remote.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/git/remote/remote.go b/internal/git/remote/remote.go index 660af4711..41e83b187 100644 --- a/internal/git/remote/remote.go +++ b/internal/git/remote/remote.go @@ -10,7 +10,11 @@ import ( //Remove removes the remote from repository func Remove(ctx context.Context, repo repository.GitRepo, name string) error { - cmd, err := git.Command(ctx, repo, "remote", "remove", name) + cmd, err := git.SafeCmd(ctx, repo, nil, git.SubCmd{ + Name: "remote", + Flags: []git.Option{git.SubSubCmd{Name: "remove"}}, + Args: []string{name}, + }) if err != nil { return err } @@ -21,7 +25,7 @@ func Remove(ctx context.Context, repo repository.GitRepo, name string) error { // Exists will always return a boolean value, but should only be depended on // when the error value is nil func Exists(ctx context.Context, repo repository.GitRepo, name string) (bool, error) { - cmd, err := git.Command(ctx, repo, "remote") + cmd, err := git.SafeCmd(ctx, repo, nil, git.SubCmd{Name: "remote"}) if err != nil { return false, err } |