update updates the version of the fetched dependency to match
(dependency kptfile.Dependency, k *kptfile.KptFile)
| 170 | |
| 171 | // update updates the version of the fetched dependency to match |
| 172 | func (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 |
| 195 | func (c Command) delete(dependency kptfile.Dependency) error { |
no test coverage detected