Deliver module releases to full-tag pages

This commit is contained in:
2026-10-10 03:10:43 +00:00
parent fdce017aff
commit 926b74bc0b
14 changed files with 317 additions and 86 deletions

View File

@@ -30,6 +30,20 @@ type TaggedSource struct {
TagObjectType string
}
// CaptureHead records the checkout commit before identity derived from files
// in that commit is inspected.
func CaptureHead(ctx context.Context, repositoryDir string) (string, error) {
head, err := run(ctx, repositoryDir, nil, "rev-parse", "--verify", "HEAD^{commit}")
if err != nil {
return "", fmt.Errorf("read checkout HEAD: %w", err)
}
head = strings.TrimSpace(head)
if !validObjectID(head) {
return "", fmt.Errorf("Git returned an invalid checkout commit %q", head)
}
return head, nil
}
// InspectTaggedSource reads the local HEAD, worktree state, and selected tag.
// Both lightweight historical tags and annotated tags are supported.
func InspectTaggedSource(ctx context.Context, repositoryDir, tag string) (TaggedSource, error) {