github.com/robryk/drone@v0.2.1-0.20140602202253-40fe4305815d/pkg/build/git/git.go (about)

     1  package git
     2  
     3  const (
     4  	DefaultGitDepth = 50
     5  )
     6  
     7  // Git stores the configuration details for
     8  // executing Git commands.
     9  type Git struct {
    10  	// Depth options instructs git to create a shallow
    11  	// clone with a history truncated to the specified
    12  	// number of revisions.
    13  	Depth *int `yaml:"depth,omitempty"`
    14  
    15  	// The name of a directory to clone into.
    16  	// TODO this still needs to be implemented. this field is
    17  	//      critical for forked Go projects, that need to clone
    18  	//      to a specific repository.
    19  	Path string `yaml:"path,omitempty"`
    20  }
    21  
    22  // GitDepth returns GitDefaultDepth
    23  // when Git.Depth is empty.
    24  // GitDepth returns Git.Depth
    25  // when it is not empty.
    26  func GitDepth(g *Git) int {
    27  	if g == nil || g.Depth == nil {
    28  		return DefaultGitDepth
    29  	}
    30  	return *g.Depth
    31  }