(ctx context.Context, target *Target, method string, newCurrent plumbing.Hash)
| 72 | } |
| 73 | |
| 74 | func (fc *FetchitConfig) UpdateCurrent(ctx context.Context, target *Target, method string, newCurrent plumbing.Hash) error { |
| 75 | directory := filepath.Base(target.Url) |
| 76 | tagName := fmt.Sprintf("current-%s", method) |
| 77 | |
| 78 | repo, err := git.PlainOpen(directory) |
| 79 | if err != nil { |
| 80 | return utils.WrapErr(err, "Error opening repository: %s", directory) |
| 81 | } |
| 82 | |
| 83 | err = repo.DeleteTag(tagName) |
| 84 | if err != nil && err != git.ErrTagNotFound { |
| 85 | return utils.WrapErr(err, "Error deleting old current tag") |
| 86 | } |
| 87 | |
| 88 | _, err = repo.CreateTag(tagName, newCurrent, nil) |
| 89 | if err != nil { |
| 90 | return utils.WrapErr(err, "Error creating new current tag with hash %s", newCurrent) |
| 91 | } |
| 92 | |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | // Side effects are running/applying changes concurrently and on success moving old "current" tag |
| 97 | func (fc *FetchitConfig) Apply( |
no test coverage detected