MCPcopy
hub / github.com/kptdev/kpt / update

Method update

internal/util/sync/sync.go:172–192  ·  view source on GitHub ↗

update updates the version of the fetched dependency to match

(dependency kptfile.Dependency, k *kptfile.KptFile)

Source from the content-addressed store, hash-verified

170
171// update updates the version of the fetched dependency to match
172func (c Command) update(dependency kptfile.Dependency, k *kptfile.KptFile) error {
173 path := filepath.Join(c.Dir, dependency.Name)
174 fmt.Fprintf(c.StdOut, "updating %q (%s) from %q to %q\n",
175 dependency.Name, path, k.Upstream.Git.Ref, dependency.Git.Ref)
176 if c.DryRun {
177 return nil
178 }
179
180 if dependency.Git.Ref == k.Upstream.Git.Ref &&
181 dependency.Git.Repo == k.Upstream.Git.Repo {
182 return nil
183 }
184 return update.Command{
185 Path: path,
186 Ref: dependency.Git.Ref,
187 Repo: dependency.Git.Repo,
188 Strategy: update.StrategyType(dependency.Strategy),
189 Verbose: c.Verbose,
190 AutoSet: dependency.AutoSet,
191 }.Run()
192}
193
194// delete removes the dependency if it exists
195func (c Command) delete(dependency kptfile.Dependency) error {

Callers 7

syncMethod · 0.95
etFunction · 0.80
atFunction · 0.80
teFunction · 0.80
ueFunction · 0.80

Calls 2

StrategyTypeTypeAlias · 0.92
RunMethod · 0.45

Tested by

no test coverage detected