MCPcopy Create free account
hub / github.com/carvel-dev/kapp-controller / configureGitRef

Method configureGitRef

cli/pkg/kctrl/local/sources/git.go:76–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74}
75
76func (g *GitSource) configureGitRef() error {
77 contents := g.vendirConfig.Contents()
78 g.ui.PrintInformationalText("A git reference can be any branch, tag, commit; origin is the name of the remote.")
79 defaultRef := contents[0].Git.Ref
80 if defaultRef == "" {
81 defaultRef = "origin/main"
82 }
83 textOpts := ui.TextOpts{
84 Label: "Enter Git Reference",
85 Default: defaultRef,
86 ValidateFunc: nil,
87 }
88 name, err := g.ui.AskForText(textOpts)
89 if err != nil {
90 return err
91 }
92
93 contents[0].Git.Ref = strings.TrimSpace(name)
94 g.vendirConfig.SetContents(contents)
95 return g.vendirConfig.Save()
96}
97
98func (g *GitSource) getIncludedPaths() error {
99 contents := g.vendirConfig.Contents()

Callers 1

ConfigureMethod · 0.95

Calls 5

ContentsMethod · 0.80
SetContentsMethod · 0.80
AskForTextMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected