mirror of https://github.com/go-gitea/gitea.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
756 B
23 lines
756 B
// Copyright 2017 The Gitea Authors. All rights reserved. |
|
// SPDX-License-Identifier: MIT |
|
|
|
package git |
|
|
|
// CommitInfo describes the first commit with the provided entry |
|
type CommitInfo struct { |
|
Entry *TreeEntry |
|
Commit *Commit |
|
SubmoduleFile *CommitSubmoduleFile |
|
} |
|
|
|
func GetCommitInfoSubmoduleFile(repoLink, fullPath string, commit *Commit, refCommitID ObjectID) (*CommitSubmoduleFile, error) { |
|
submodule, err := commit.GetSubModule(fullPath) |
|
if err != nil { |
|
return nil, err |
|
} |
|
if submodule == nil { |
|
// unable to find submodule from ".gitmodules" file |
|
return NewCommitSubmoduleFile(repoLink, fullPath, "", refCommitID.String()), nil |
|
} |
|
return NewCommitSubmoduleFile(repoLink, fullPath, submodule.URL, refCommitID.String()), nil |
|
}
|
|
|