code.gitea.io/gitea@v1.19.3/modules/git/repo_blob_gogit.go (about)

     1  // Copyright 2018 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  //go:build gogit
     5  
     6  package git
     7  
     8  import (
     9  	"github.com/go-git/go-git/v5/plumbing"
    10  )
    11  
    12  func (repo *Repository) getBlob(id SHA1) (*Blob, error) {
    13  	encodedObj, err := repo.gogitRepo.Storer.EncodedObject(plumbing.AnyObject, id)
    14  	if err != nil {
    15  		return nil, ErrNotExist{id.String(), ""}
    16  	}
    17  
    18  	return &Blob{
    19  		ID:              id,
    20  		gogitEncodedObj: encodedObj,
    21  	}, nil
    22  }