mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
git fix state event refs
This commit is contained in:
2 files changed
+229
-22
No files matched your search
+32
-16
@@ -881,12 +881,6 @@ export class Git {
|
||||
throw new Error('No clone URLs found in repository announcement');
|
||||
}
|
||||
|
||||
// Collect all refs (HEAD and branches) to include in the state event
|
||||
const refNames = await git.listRefs({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
});
|
||||
|
||||
const stateTags: string[][] = [
|
||||
['d', nostrURI.identifier],
|
||||
];
|
||||
@@ -906,16 +900,38 @@ export class Git {
|
||||
stateTags.push(['HEAD', headRef]);
|
||||
}
|
||||
|
||||
// Add all branch refs as tags
|
||||
for (const refName of refNames) {
|
||||
if (refName.startsWith('refs/heads/') || refName.startsWith('refs/tags/')) {
|
||||
const oid = await git.resolveRef({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
ref: refName,
|
||||
});
|
||||
stateTags.push([refName, oid]);
|
||||
}
|
||||
// Collect all branch refs
|
||||
const branchNames = await git.listRefs({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
filepath: 'refs/heads',
|
||||
});
|
||||
|
||||
for (const branchName of branchNames) {
|
||||
const refName = `refs/heads/${branchName}`;
|
||||
const oid = await git.resolveRef({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
ref: refName,
|
||||
});
|
||||
stateTags.push([refName, oid]);
|
||||
}
|
||||
|
||||
// Collect all tag refs
|
||||
const tagNames = await git.listRefs({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
filepath: 'refs/tags',
|
||||
});
|
||||
|
||||
for (const tagName of tagNames) {
|
||||
const refName = `refs/tags/${tagName}`;
|
||||
const oid = await git.resolveRef({
|
||||
fs: this.fs,
|
||||
dir,
|
||||
ref: refName,
|
||||
});
|
||||
stateTags.push([refName, oid]);
|
||||
}
|
||||
|
||||
// Republish repo announcement event
|
||||
|
||||
Reference in new issue
Block a user