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