You've already forked agentic-coding-workflow
功能补齐、查看git提交历史
This commit is contained in:
@@ -79,6 +79,18 @@ func (s *gitOpsService) PushOnMain(ctx context.Context, c Caller, wsID uuid.UUID
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *gitOpsService) LogOnMain(ctx context.Context, c Caller, wsID uuid.UUID, n int) ([]git.Commit, error) {
|
||||
ws, err := s.guardWorkspaceRead(ctx, c, wsID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commits, err := s.gitr.Log(ctx, ws.MainPath, n)
|
||||
if err != nil {
|
||||
return nil, errs.Wrap(err, errs.CodeGitCmdFailed, "git log")
|
||||
}
|
||||
return commits, nil
|
||||
}
|
||||
|
||||
// ===== Worktree =====
|
||||
|
||||
func (s *gitOpsService) StatusOnWorktree(ctx context.Context, c Caller, wtID uuid.UUID) ([]git.FileStatus, error) {
|
||||
@@ -133,6 +145,18 @@ func (s *gitOpsService) PushOnWorktree(ctx context.Context, c Caller, wtID uuid.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *gitOpsService) LogOnWorktree(ctx context.Context, c Caller, wtID uuid.UUID, n int) ([]git.Commit, error) {
|
||||
wt, _, err := s.guardWorktreeRead(ctx, c, wtID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
commits, err := s.gitr.Log(ctx, wt.Path, n)
|
||||
if err != nil {
|
||||
return nil, errs.Wrap(err, errs.CodeGitCmdFailed, "git log")
|
||||
}
|
||||
return commits, nil
|
||||
}
|
||||
|
||||
// ===== guards =====
|
||||
|
||||
func (s *gitOpsService) guardWorkspaceRead(ctx context.Context, c Caller, wsID uuid.UUID) (*Workspace, error) {
|
||||
|
||||
Reference in New Issue
Block a user