1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00
woodpecker/pkg/build/git/git.go

32 lines
767 B
Go
Raw Normal View History

package git
const (
DefaultGitDepth = 50
)
// Git stores the configuration details for
// executing Git commands.
type Git struct {
2014-02-18 08:41:56 +03:00
// Depth options instructs git to create a shallow
// clone with a history truncated to the specified
// number of revisions.
Depth *int `yaml:"depth,omitempty"`
2014-02-18 08:41:56 +03:00
// The name of a directory to clone into.
// TODO this still needs to be implemented. this field is
// critical for forked Go projects, that need to clone
// to a specific repository.
Path string `yaml:"path,omitempty"`
}
// GitDepth returns GitDefaultDepth
// when Git.Depth is empty.
// GitDepth returns Git.Depth
// when it is not empty.
func GitDepth(g *Git) int {
if g == nil || g.Depth == nil {
return DefaultGitDepth
}
return *g.Depth
}