Deliver module releases to full-tag pages
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user