diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-05 15:14:49 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-09 14:30:33 +0300 |
commit | fb76136dee3965cd66fe445f97f831fefca5df88 (patch) | |
tree | c033529fc7663d67e7a3e76b896920fe7dd17fea /internal/gitaly/service/repository | |
parent | 0dda4808b7ae13f7eca80ffb6b40255d0cdc8d50 (diff) |
catfile: Convert ObjectInfo to use typed OID
The ObjectInfo is currently using a string OID. Convert it to use the
proper ObjectID type. This also increases safety in case we ever get
something from git-cat-file(1) which is not a recognized OID.
Diffstat (limited to 'internal/gitaly/service/repository')
-rw-r--r-- | internal/gitaly/service/repository/apply_gitattributes.go | 7 | ||||
-rw-r--r-- | internal/gitaly/service/repository/raw_changes.go | 2 |
2 files changed, 2 insertions, 7 deletions
diff --git a/internal/gitaly/service/repository/apply_gitattributes.go b/internal/gitaly/service/repository/apply_gitattributes.go index 6c4335f84..0f0728d29 100644 --- a/internal/gitaly/service/repository/apply_gitattributes.go +++ b/internal/gitaly/service/repository/apply_gitattributes.go @@ -83,13 +83,8 @@ func (s *server) applyGitattributes(ctx context.Context, c catfile.Batch, repoPa return err } - blobOID, err := git.NewObjectIDFromHex(blobInfo.Oid) - if err != nil { - return err - } - // Vote on the contents of the newly written gitattributes file. - if err := s.vote(ctx, blobOID); err != nil { + if err := s.vote(ctx, blobInfo.Oid); err != nil { return fmt.Errorf("could not commit gitattributes: %w", err) } diff --git a/internal/gitaly/service/repository/raw_changes.go b/internal/gitaly/service/repository/raw_changes.go index 9db19100c..df4b89e2b 100644 --- a/internal/gitaly/service/repository/raw_changes.go +++ b/internal/gitaly/service/repository/raw_changes.go @@ -158,7 +158,7 @@ func changeFromDiff(ctx context.Context, batch catfile.Batch, d *rawdiff.Diff) ( return nil, fmt.Errorf("find %q: %v", shortBlobID, err) } - resp.BlobId = info.Oid + resp.BlobId = info.Oid.String() resp.Size = info.Size } |