({ fs, gitdir, ref, value })
| 177 | */ |
| 178 | // TODO: make this less crude? |
| 179 | static async writeRef({ fs, gitdir, ref, value }) { |
| 180 | // Validate input |
| 181 | if (!value.match(/[0-9a-f]{40}/)) { |
| 182 | throw new InvalidOidError(value) |
| 183 | } |
| 184 | await acquireLock(ref, async () => |
| 185 | fs.write(join(gitdir, ref), `${value.trim()}\n`, 'utf8') |
| 186 | ) |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Writes a symbolic ref to the file system. |
no test coverage detected