Skip to content

Commit 14c1776

Browse files
committed
feat: added file sync
1 parent fdf6ec9 commit 14c1776

File tree

15 files changed

+998
-357
lines changed

15 files changed

+998
-357
lines changed

core/generated/git/v1/git.pb.go

Lines changed: 277 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/generated/git/v1/v1connect/git.connect.go

Lines changed: 87 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/internal/git/handler.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,33 @@ func (h *Handler) Commit(_ context.Context, c *connect.Request[v1.CommitQuery])
5353

5454
return connect.NewResponse(&v1.Empty{}), nil
5555
}
56+
57+
func (h *Handler) ListBranches(context.Context, *connect.Request[v1.ListBranchesRequest]) (*connect.Response[v1.ListBranchesResponse], error) {
58+
branches, err := h.srv.ListBranches()
59+
if err != nil {
60+
return nil, err
61+
}
62+
return connect.NewResponse(&v1.ListBranchesResponse{Branches: branches}), nil
63+
}
64+
65+
func (h *Handler) SyncFile(_ context.Context, req *connect.Request[v1.FileRequest]) (*connect.Response[v1.Empty], error) {
66+
branch := req.Msg.GetBranch()
67+
filepath := req.Msg.GetFilepath()
68+
69+
if err := h.srv.SyncFile(filepath, branch); err != nil {
70+
return nil, err
71+
}
72+
73+
return connect.NewResponse(&v1.Empty{}), nil
74+
}
75+
76+
func (h *Handler) ListFileFromBranch(_ context.Context, req *connect.Request[v1.BranchListFileRequest]) (*connect.Response[v1.BranchListFileResponse], error) {
77+
branch := req.Msg.GetBranch()
78+
79+
inBranch, err := h.srv.ListFilesInBranch(branch)
80+
if err != nil {
81+
return nil, err
82+
}
83+
84+
return connect.NewResponse(&v1.BranchListFileResponse{Files: inBranch}), nil
85+
}

0 commit comments

Comments
 (0)