gitea源码

123456789101112131415161718192021222324
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package git
  4. // CommitInfo describes the first commit with the provided entry
  5. type CommitInfo struct {
  6. Entry *TreeEntry
  7. Commit *Commit
  8. SubmoduleFile *CommitSubmoduleFile
  9. }
  10. func GetCommitInfoSubmoduleFile(repoLink, fullPath string, commit *Commit, refCommitID ObjectID) (*CommitSubmoduleFile, error) {
  11. submodule, err := commit.GetSubModule(fullPath)
  12. if err != nil {
  13. return nil, err
  14. }
  15. if submodule == nil {
  16. // unable to find submodule from ".gitmodules" file
  17. return NewCommitSubmoduleFile(repoLink, fullPath, "", refCommitID.String()), nil
  18. }
  19. return NewCommitSubmoduleFile(repoLink, fullPath, submodule.URL, refCommitID.String()), nil
  20. }