gunk-dev/the-valley

exec_client.go

source4cbb5ec9c5dbmain's published tip history
3.4 KiB
1package git
2
3import "context"
4
5// ExecClient implements Client by shelling out to the git binary.
6type ExecClient struct{}
7
8// NewExecClient returns a new ExecClient.
9func NewExecClient() *ExecClient {
10 return &ExecClient{}
11}
12
13func (c *ExecClient) CommonDir(ctx context.Context) (string, error) {
14 return CommonDir(ctx)
15}
16
17func (c *ExecClient) FetchAll(ctx context.Context, repoDir string) error {
18 return FetchAll(ctx, repoDir)
19}
20
21func (c *ExecClient) FetchBranch(ctx context.Context, repoDir, branch string) error {
22 return FetchBranch(ctx, repoDir, branch)
23}
24
25func (c *ExecClient) WorktreeAdd(ctx context.Context, repoDir, path, branch, startPoint string) error {
26 return WorktreeAdd(ctx, repoDir, path, branch, startPoint)
27}
28
29func (c *ExecClient) WorktreeRemove(ctx context.Context, repoDir, path string) error {
30 return WorktreeRemove(ctx, repoDir, path)
31}
32
33func (c *ExecClient) WorktreeAddTrack(ctx context.Context, repoDir, path, branch string, discard bool) error {
34 return WorktreeAddTrack(ctx, repoDir, path, branch, discard)
35}
36
37func (c *ExecClient) WorktreePrune(ctx context.Context, repoDir string) error {
38 return WorktreePrune(ctx, repoDir)
39}
40
41func (c *ExecClient) BranchDelete(ctx context.Context, repoDir, branch string) error {
42 return BranchDelete(ctx, repoDir, branch)
43}
44
45func (c *ExecClient) IsClean(ctx context.Context, repoDir string) (bool, error) {
46 return IsClean(ctx, repoDir)
47}
48
49func (c *ExecClient) CurrentBranch(ctx context.Context, repoDir string) (string, error) {
50 return CurrentBranch(ctx, repoDir)
51}
52
53func (c *ExecClient) HasUpstream(ctx context.Context, repoDir string) (bool, error) {
54 return HasUpstream(ctx, repoDir)
55}
56
57func (c *ExecClient) MergeFastForward(ctx context.Context, repoDir string) error {
58 return MergeFastForward(ctx, repoDir)
59}
60
61func (c *ExecClient) CommitsBehindUpstream(ctx context.Context, repoDir string) (int, error) {
62 return CommitsBehindUpstream(ctx, repoDir)
63}
64
65func (c *ExecClient) CommitsAhead(ctx context.Context, repoDir, base, ref string) (int, error) {
66 return CommitsAhead(ctx, repoDir, base, ref)
67}
68
69func (c *ExecClient) BranchPushed(ctx context.Context, repoDir, branch string) (bool, error) {
70 return BranchPushed(ctx, repoDir, branch)
71}
72
73func (c *ExecClient) RemoteBranchSHA(ctx context.Context, repoDir, branch string) (string, error) {
74 return RemoteBranchSHA(ctx, repoDir, branch)
75}
76
77func (c *ExecClient) EnsureDataRef(ctx context.Context, repoDir, dataRef string) error {
78 return EnsureDataRef(ctx, repoDir, dataRef)
79}
80
81func (c *ExecClient) SyncToDataRef(ctx context.Context, repoDir, dataRef, commitMsg string, files map[string]string) (string, error) {
82 return SyncToDataRef(ctx, repoDir, dataRef, commitMsg, files)
83}
84
85func (c *ExecClient) EnsureClone(ctx context.Context, cloneURL, destDir string) error {
86 return EnsureClone(ctx, cloneURL, destDir)
87}
88
89func (c *ExecClient) PushDataRef(ctx context.Context, repoDir, dataRef string) (string, error) {
90 return PushDataRef(ctx, repoDir, dataRef)
91}
92
93func (c *ExecClient) FetchDataRef(ctx context.Context, repoDir, dataRef string) error {
94 return FetchDataRef(ctx, repoDir, dataRef)
95}
96
97func (c *ExecClient) ReadDataRefFile(ctx context.Context, repoDir, dataRef, treePath string) ([]byte, error) {
98 return ReadDataRefFile(ctx, repoDir, dataRef, treePath)
99}
100
101func (c *ExecClient) InstallHooks(ctx context.Context, worktreeDir string, prov Provenance, format []string) error {
102 return InstallHooks(ctx, worktreeDir, prov, format)
103}
104
105// compile-time check
106var _ Client = (*ExecClient)(nil)