mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-18 08:26:45 +02:00
23 lines
402 B
Go
23 lines
402 B
Go
|
package git
|
||
|
|
||
|
const (
|
||
|
DefaultGitDepth = 50
|
||
|
)
|
||
|
|
||
|
// Git stores the configuration details for
|
||
|
// executing Git commands.
|
||
|
type Git struct {
|
||
|
Depth *int `yaml:"depth,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
|
||
|
}
|