diff options
author | Igor Wiedler <iwiedler@gitlab.com> | 2020-11-26 13:50:31 +0300 |
---|---|---|
committer | Igor Wiedler <iwiedler@gitlab.com> | 2020-11-26 14:33:48 +0300 |
commit | f054e9559ab3173b945774503ab206c13a7a7568 (patch) | |
tree | dd9f4172f8185aef1f1f3a6ec24b4085e2c1bb3e /internal/gitaly/service/repository/apply_gitattributes.go | |
parent | fdf84bafe32f50b63eaa61dd9b6655415251967a (diff) |
Require the ctx for each Batch command invokation
This is to support instrumentation that depends on the caller's context.
Diffstat (limited to 'internal/gitaly/service/repository/apply_gitattributes.go')
-rw-r--r-- | internal/gitaly/service/repository/apply_gitattributes.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/gitaly/service/repository/apply_gitattributes.go b/internal/gitaly/service/repository/apply_gitattributes.go index 9a89aef9d..dc6d67672 100644 --- a/internal/gitaly/service/repository/apply_gitattributes.go +++ b/internal/gitaly/service/repository/apply_gitattributes.go @@ -17,11 +17,11 @@ import ( const attributesFileMode os.FileMode = 0644 -func applyGitattributes(c *catfile.Batch, repoPath string, revision []byte) error { +func applyGitattributes(ctx context.Context, c *catfile.Batch, repoPath string, revision []byte) error { infoPath := filepath.Join(repoPath, "info") attributesPath := filepath.Join(infoPath, "attributes") - _, err := c.Info(string(revision)) + _, err := c.Info(ctx, string(revision)) if err != nil { if catfile.IsNotFound(err) { return status.Errorf(codes.InvalidArgument, "Revision doesn't exist") @@ -30,7 +30,7 @@ func applyGitattributes(c *catfile.Batch, repoPath string, revision []byte) erro return err } - blobInfo, err := c.Info(fmt.Sprintf("%s:.gitattributes", revision)) + blobInfo, err := c.Info(ctx, fmt.Sprintf("%s:.gitattributes", revision)) if err != nil && !catfile.IsNotFound(err) { return err } @@ -55,7 +55,7 @@ func applyGitattributes(c *catfile.Batch, repoPath string, revision []byte) erro } defer os.Remove(tempFile.Name()) - blobObj, err := c.Blob(blobInfo.Oid) + blobObj, err := c.Blob(ctx, blobInfo.Oid) if err != nil { return err } @@ -94,7 +94,7 @@ func (s *server) ApplyGitattributes(ctx context.Context, in *gitalypb.ApplyGitat return nil, err } - if err := applyGitattributes(c, repoPath, in.GetRevision()); err != nil { + if err := applyGitattributes(ctx, c, repoPath, in.GetRevision()); err != nil { return nil, err } |