({
fs: _fs,
onSign,
dir,
gitdir = join(dir, '.git'),
ref = 'refs/notes/commits',
oid,
note,
force,
author: _author,
committer: _committer,
signingKey,
cache = {},
})
| 39 | */ |
| 40 | |
| 41 | export async function addNote({ |
| 42 | fs: _fs, |
| 43 | onSign, |
| 44 | dir, |
| 45 | gitdir = join(dir, '.git'), |
| 46 | ref = 'refs/notes/commits', |
| 47 | oid, |
| 48 | note, |
| 49 | force, |
| 50 | author: _author, |
| 51 | committer: _committer, |
| 52 | signingKey, |
| 53 | cache = {}, |
| 54 | }) { |
| 55 | try { |
| 56 | assertParameter('fs', _fs) |
| 57 | assertParameter('gitdir', gitdir) |
| 58 | assertParameter('oid', oid) |
| 59 | assertParameter('note', note) |
| 60 | if (signingKey) { |
| 61 | assertParameter('onSign', onSign) |
| 62 | } |
| 63 | const fs = new FileSystem(_fs) |
| 64 | |
| 65 | const author = await normalizeAuthorObject({ fs, gitdir, author: _author }) |
| 66 | if (!author) throw new MissingNameError('author') |
| 67 | |
| 68 | const committer = await normalizeCommitterObject({ |
| 69 | fs, |
| 70 | gitdir, |
| 71 | author, |
| 72 | committer: _committer, |
| 73 | }) |
| 74 | if (!committer) throw new MissingNameError('committer') |
| 75 | |
| 76 | const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir }) |
| 77 | return await _addNote({ |
| 78 | fs, |
| 79 | cache, |
| 80 | onSign, |
| 81 | gitdir: updatedGitdir, |
| 82 | ref, |
| 83 | oid, |
| 84 | note, |
| 85 | force, |
| 86 | author, |
| 87 | committer, |
| 88 | signingKey, |
| 89 | }) |
| 90 | } catch (err) { |
| 91 | err.caller = 'git.addNote' |
| 92 | throw err |
| 93 | } |
| 94 | } |
no test coverage detected
searching dependent graphs…