added code to specify a gopath

This commit is contained in:
Brad Rydzewski
2014-06-12 12:51:55 -07:00
parent aec9b33048
commit 43e382b5a1
3 changed files with 18 additions and 5 deletions

View File

@@ -13,10 +13,7 @@ type Git struct {
Depth *int `yaml:"depth,omitempty"`
// 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"`
Path *string `yaml:"path,omitempty"`
}
// GitDepth returns GitDefaultDepth
@@ -29,3 +26,14 @@ func GitDepth(g *Git) int {
}
return *g.Depth
}
// GitPath returns the given default path
// when Git.Path is empty.
// GitPath returns Git.Path
// when it is not empty.
func GitPath(g *Git, defaultPath string) string {
if g == nil || g.Path == nil {
return defaultPath
}
return *g.Path
}