@page "/git/{Repository}/refs" @inherits GitPage @Repository refs — git
@if (Refs is not { } refs) {

No repository called @Repository.

} else {

branches @refs.Branches.Count

@if (refs.Branches.Count == 0) {

No branches.

} else {
@foreach (var branch in refs.Branches) { }
name commit subject author age
@branch.Name @Shorten(branch.Sha) @branch.Tip?.Summary @branch.Tip?.Author.Name @Age(branch.Tip?.Committer.When)
}

tags @refs.Tags.Count

@if (refs.Tags.Count == 0) {

No tags.

} else {
@foreach (var tag in refs.Tags) { @* An annotated tag's own message, falling back to the subject of what it points at — which is all a lightweight tag has. *@ }
name commit message age
@tag.Name @if (tag.Tip is { } tip) { @Shorten(tip.Sha) } @(First(tag.Message) ?? tag.Tip?.Summary) @Age(tag.Tip?.Committer.When)
}
}
@code { private GitRefsView? Refs { get; set; } protected override void OnParametersSet() { Refs = Service.GetRefs(Repository); if (Refs is null) NotFound(); } private static string Shorten(string sha) => sha.Length >= 10 ? sha[..10] : sha; private static string? First(string? message) => message?.Split('\n', 2)[0].Trim() is { Length: > 0 } line ? line : null; }