1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package objectpool
import (
"context"
"os"
"path/filepath"
"gitlab.com/gitlab-org/gitaly/v14/internal/git"
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
)
// clone a repository to a pool, without setting the alternates, is not the
// resposibility of this function.
func (o *ObjectPool) clone(ctx context.Context, repo *gitalypb.Repository) error {
repoPath, err := o.locator.GetRepoPath(repo)
if err != nil {
return err
}
cmd, err := o.gitCmdFactory.NewWithoutRepo(ctx,
git.SubCmd{
Name: "clone",
Flags: []git.Option{
git.Flag{Name: "--quiet"},
git.Flag{Name: "--bare"},
git.Flag{Name: "--local"},
},
Args: []string{repoPath, o.FullPath()},
},
git.WithRefTxHook(ctx, repo, o.cfg),
)
if err != nil {
return err
}
return cmd.Wait()
}
func (o *ObjectPool) removeHooksDir() error {
return os.RemoveAll(filepath.Join(o.FullPath(), "hooks"))
}
|