(options UpdateOptions)
| 48 | } |
| 49 | |
| 50 | func (u GitPatchUpdater) Update(options UpdateOptions) error { |
| 51 | u.UpdateOptions = options |
| 52 | u.packageRef = path.Join(strings.TrimLeft(u.KptFile.Upstream.Git.Directory, "/"), |
| 53 | u.ToRef) |
| 54 | if err := u.calculatePatch(); err != nil { |
| 55 | return err |
| 56 | } |
| 57 | |
| 58 | // write the patch to a file instead of applying it |
| 59 | if options.DryRun { |
| 60 | _, err := io.WriteString(os.Stderr, fmt.Sprintf( |
| 61 | "patch can be applied with 'git am -3 --directory %s'\n", options.PackagePath)) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | _, err = io.WriteString(options.Output, u.patch) |
| 66 | return err |
| 67 | } |
| 68 | |
| 69 | // apply the patch to pkg |
| 70 | return u.patchLocalPackage() |
| 71 | } |
| 72 | |
| 73 | // calculatePatch runs a series of git commands to calculate a patch which can be used |
| 74 | // to update the local package |
nothing calls this directly
no test coverage detected