FixLockableFileWriteFlags checks each file in the provided list, and for those which are lockable, makes sure their write flags are set correctly based on whether they are currently locked or unlocked. Files which are unlocked are made read-only, files which are locked are made writeable. Files whic
(files []string)
| 137 | // state correctly reflects the locking state, and is more efficient than |
| 138 | // FixAllLockableFileWriteFlags when you know which files changed |
| 139 | func (c *Client) FixLockableFileWriteFlags(files []string) error { |
| 140 | // early-out if no lockable patterns |
| 141 | if len(c.GetLockablePatterns()) == 0 { |
| 142 | return nil |
| 143 | } |
| 144 | |
| 145 | var multiErr error |
| 146 | for _, f := range files { |
| 147 | err := c.fixSingleFileWriteFlags(f, c.getLockableFilter(), nil) |
| 148 | if err != nil { |
| 149 | multiErr = errors.Join(multiErr, err) |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | return multiErr |
| 154 | } |
| 155 | |
| 156 | // fixSingleFileWriteFlags fixes write flags on a single file |
| 157 | // If lockablePatterns is non-nil, then any file matching those patterns will be |
no test coverage detected