(ctx context.Context, rep repo.Repository)
| 40 | } |
| 41 | |
| 42 | func (c *commandRepositorySetClient) run(ctx context.Context, rep repo.Repository) error { |
| 43 | var anyChange bool |
| 44 | |
| 45 | opt := rep.ClientOptions() |
| 46 | |
| 47 | if c.repoClientOptionsReadOnly { |
| 48 | if opt.ReadOnly { |
| 49 | log(ctx).Info("Repository is already in read-only mode.") |
| 50 | } else { |
| 51 | opt.ReadOnly = true |
| 52 | anyChange = true |
| 53 | |
| 54 | log(ctx).Info("Setting repository to read-only mode.") |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | if c.repoClientOptionsReadWrite { |
| 59 | if !opt.ReadOnly { |
| 60 | log(ctx).Info("Repository is already in read-write mode.") |
| 61 | } else { |
| 62 | opt.ReadOnly = false |
| 63 | anyChange = true |
| 64 | |
| 65 | log(ctx).Info("Setting repository to read-write mode.") |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | if c.repoClientOptionsPermissiveCacheLoading { |
| 70 | if !opt.PermissiveCacheLoading { |
| 71 | log(ctx).Info("Repository fails on read of bad index blobs.") |
| 72 | } else { |
| 73 | opt.PermissiveCacheLoading = true |
| 74 | anyChange = true |
| 75 | |
| 76 | log(ctx).Info("Setting to load indices into cache permissively.") |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if v := c.repoClientOptionsDescription; len(v) > 0 { |
| 81 | opt.Description = v[0] |
| 82 | anyChange = true |
| 83 | |
| 84 | log(ctx).Infof("Setting description to %v", opt.Description) |
| 85 | } |
| 86 | |
| 87 | if v := c.repoClientOptionsUsername; len(v) > 0 { |
| 88 | opt.Username = v[0] |
| 89 | anyChange = true |
| 90 | |
| 91 | log(ctx).Infof("Setting local username to %v", opt.Username) |
| 92 | } |
| 93 | |
| 94 | if v := c.repoClientOptionsHostname; len(v) > 0 { |
| 95 | opt.Hostname = v[0] |
| 96 | anyChange = true |
| 97 | |
| 98 | log(ctx).Infof("Setting local hostname to %v", opt.Hostname) |
| 99 | } |
nothing calls this directly
no test coverage detected