Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

tree_blob.go 479B

12345678910111213141516171819
  1. // Copyright 2015 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // SPDX-License-Identifier: MIT
  4. package git
  5. // GetBlobByPath get the blob object according the path
  6. func (t *Tree) GetBlobByPath(relpath string) (*Blob, error) {
  7. entry, err := t.GetTreeEntryByPath(relpath)
  8. if err != nil {
  9. return nil, err
  10. }
  11. if !entry.IsDir() && !entry.IsSubModule() {
  12. return entry.Blob(), nil
  13. }
  14. return nil, ErrNotExist{"", relpath}
  15. }