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
42
43
44
45
46
|
package commit
import (
"context"
"github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"
"gitlab.com/gitlab-org/gitaly/internal/git"
"gitlab.com/gitlab-org/gitaly/internal/git/log"
"gitlab.com/gitlab-org/gitaly/internal/helper/chunk"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
)
func sendCommits(ctx context.Context, sender chunk.Sender, repo *gitalypb.Repository, revisionRange []string, paths []string, options *gitalypb.GlobalOptions, extraArgs ...git.Option) error {
cmd, err := log.GitLogCommand(ctx, repo, revisionRange, paths, options, extraArgs...)
if err != nil {
return err
}
logParser, err := log.NewLogParser(ctx, repo, cmd)
if err != nil {
return err
}
chunker := chunk.New(sender)
for logParser.Parse(ctx) {
if err := chunker.Send(logParser.Commit()); err != nil {
return err
}
}
if err := logParser.Err(); err != nil {
return err
}
if err := chunker.Flush(); err != nil {
return err
}
if err := cmd.Wait(); err != nil {
// We expect this error to be caused by non-existing references. In that
// case, we just log the error and send no commits to the `sender`.
ctxlogrus.Extract(ctx).WithError(err).Info("ignoring git-log error")
}
return nil
}
|