diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-16 15:25:14 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-07-21 10:25:39 +0300 |
commit | 2964ce296dbe2d0fac57aa04467fef23eced1f4d (patch) | |
tree | 4cf9a5f47b851740698cffa747a603bb411c4b32 | |
parent | fef81423ae59dbedc5270f790198b0f115cd6bf9 (diff) |
git: Mark git-clone(1) as supporting `--end-of-options`
The git-clone(1) command is currently labelled as not supporting the
`--end-of-options` separator, even though Git supports this just fine.
What it doesn't support though is intermixed use of this separator with
the `--` separator, but this is exactly how we use it in several of the
callsites because we pass arguments as post-separator arguments.
Adjust the callsites to not pass the revision as a post-separator
argument, but instead as a normal argument. By marking this command as
supporting `--end-of-options`, this has exactly the same semantics given
that both separators can be used interchangeably in this context, but it
now automatically injects the separator.
5 files changed, 9 insertions, 9 deletions
diff --git a/internal/git/command_description.go b/internal/git/command_description.go index 2d9c387f3..5690f418d 100644 --- a/internal/git/command_description.go +++ b/internal/git/command_description.go @@ -46,7 +46,7 @@ var commandDescriptions = map[string]commandDescription{ flags: scNoEndOfOptions, }, "clone": { - flags: scNoEndOfOptions | scGeneratesPackfiles, + flags: scGeneratesPackfiles, }, "commit": { flags: 0, diff --git a/internal/gitaly/service/repository/clone_from_pool_internal.go b/internal/gitaly/service/repository/clone_from_pool_internal.go index e3dd0dbaa..9173e9849 100644 --- a/internal/gitaly/service/repository/clone_from_pool_internal.go +++ b/internal/gitaly/service/repository/clone_from_pool_internal.go @@ -108,9 +108,9 @@ func (s *server) cloneFromPool(ctx context.Context, objectPoolRepo *gitalypb.Obj cmd, err := s.gitCmdFactory.NewWithoutRepo(ctx, git.SubCmd{ - Name: "clone", - Flags: []git.Option{git.Flag{Name: "--bare"}, git.Flag{Name: "--shared"}}, - PostSepArgs: []string{objectPoolPath, repositoryPath}, + Name: "clone", + Flags: []git.Option{git.Flag{Name: "--bare"}, git.Flag{Name: "--shared"}}, + Args: []string{objectPoolPath, repositoryPath}, }, git.WithRefTxHook(ctx, repo, s.cfg), ) diff --git a/internal/gitaly/service/repository/create_from_bundle.go b/internal/gitaly/service/repository/create_from_bundle.go index 989a2b472..5fa6d7e62 100644 --- a/internal/gitaly/service/repository/create_from_bundle.go +++ b/internal/gitaly/service/repository/create_from_bundle.go @@ -79,7 +79,7 @@ func (s *server) CreateRepositoryFromBundle(stream gitalypb.RepositoryService_Cr git.Flag{Name: "--bare"}, git.Flag{Name: "--quiet"}, }, - PostSepArgs: []string{bundlePath, repoPath}, + Args: []string{bundlePath, repoPath}, }, git.WithStderr(&stderr), git.WithRefTxHook(ctx, repo, s.cfg), diff --git a/internal/gitaly/service/repository/create_from_url.go b/internal/gitaly/service/repository/create_from_url.go index 32fdd8030..b7e3f9d42 100644 --- a/internal/gitaly/service/repository/create_from_url.go +++ b/internal/gitaly/service/repository/create_from_url.go @@ -49,9 +49,9 @@ func (s *server) cloneFromURLCommand(ctx context.Context, repo *gitalypb.Reposit return s.gitCmdFactory.NewWithoutRepo(ctx, git.SubCmd{ - Name: "clone", - Flags: cloneFlags, - PostSepArgs: []string{u.String(), repositoryFullPath}, + Name: "clone", + Flags: cloneFlags, + Args: []string{u.String(), repositoryFullPath}, }, git.WithStderr(stderr), git.WithRefTxHook(ctx, repo, s.cfg), diff --git a/internal/gitaly/service/repository/fork.go b/internal/gitaly/service/repository/fork.go index 55baa8715..54d6ace9a 100644 --- a/internal/gitaly/service/repository/fork.go +++ b/internal/gitaly/service/repository/fork.go @@ -60,7 +60,7 @@ func (s *server) CreateFork(ctx context.Context, req *gitalypb.CreateForkRequest git.Flag{Name: "--bare"}, git.Flag{Name: "--no-local"}, }, - PostSepArgs: []string{ + Args: []string{ fmt.Sprintf("%s:%s", gitalyssh.GitalyInternalURL, sourceRepository.RelativePath), targetRepositoryFullPath, }, |