Skip to content

Commit 77d6665

Browse files
committed
fixup! WIP pushNotesRef: allow for concurrent operations
1 parent 65db16b commit 77d6665

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/gitgitgadget.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,17 @@ export class GitGitGadget {
256256

257257
// TODO: verify that the push failed because of a non-fast-forward
258258

259+
// wait a while before trying again to push (after fetching the remote notes ref and merging it)
259260
await this.sleep(backoff);
261+
260262
const output = await git(["fetch", this.publishTagsAndNotesToRemote, "--", `${this.notes.notesRef}`], {
261263
workDir: this.workDir,
262264
});
263-
// TODO: parse the output to obtain the OID of the remote notes ref,
265+
// parse the output to obtain the OID of the remote notes ref
266+
const [, fetchOID ] = output.match(/\.\.([0-9a-f]+)/) || [];
267+
if (!fetchOID) throw new Error(`Could not parse the output of 'git fetch':\n${output}`);
264268
// then use GitNotes.notesSync(remoteCommit)
265-
// throw exception if any of that failed
269+
await this.notes.notesSync(fetchOID);
266270
}
267271
}
268272

0 commit comments

Comments
 (0)