mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Code]: ignore annotated tags that can't be peeled (#37917)
This commit is contained in:
parent
a5df2ee962
commit
c1056d243b
2 changed files with 11 additions and 5 deletions
|
@ -531,10 +531,15 @@ export function commitInfo(commit: Commit): CommitInfo {
|
|||
};
|
||||
}
|
||||
|
||||
export async function referenceInfo(ref: Reference): Promise<ReferenceInfo> {
|
||||
export async function referenceInfo(ref: Reference): Promise<ReferenceInfo | null> {
|
||||
const repository = ref.owner();
|
||||
const object = await ref.peel(Object.TYPE.COMMIT);
|
||||
const commit = await repository.getCommit(object.id());
|
||||
let commit: CommitInfo | undefined;
|
||||
try {
|
||||
const object = await ref.peel(Object.TYPE.COMMIT);
|
||||
commit = commitInfo(await repository.getCommit(object.id()));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
let type: ReferenceType;
|
||||
if (ref.isTag()) {
|
||||
type = ReferenceType.TAG;
|
||||
|
@ -548,7 +553,7 @@ export async function referenceInfo(ref: Reference): Promise<ReferenceInfo> {
|
|||
return {
|
||||
name: ref.shorthand(),
|
||||
reference: ref.name(),
|
||||
commit: commitInfo(commit),
|
||||
commit,
|
||||
type,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -220,7 +220,8 @@ export function fileRoute(server: CodeServerRouter, options: ServerOptions) {
|
|||
try {
|
||||
const repository = await gitOperations.openRepo(uri);
|
||||
const references = await repository.getReferences(Reference.TYPE.DIRECT);
|
||||
return await Promise.all(references.map(referenceInfo));
|
||||
const referenceInfos = await Promise.all(references.map(referenceInfo));
|
||||
return referenceInfos.filter(info => info !== null);
|
||||
} catch (e) {
|
||||
if (e.isBoom) {
|
||||
return e;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue