Capture diagnostic identities and rehearsal records

This commit is contained in:
2026-12-05 22:45:28 +00:00
parent 6f01e9ef0a
commit 181e5a030c
19 changed files with 1284 additions and 60 deletions

View File

@@ -47,6 +47,22 @@ func RepositoryRoot(ctx context.Context, directory string) (string, error) {
return normalizeRepositoryRoot(root)
}
// ResolveCommit resolves a revision to its full commit ID without changing the checkout.
func ResolveCommit(ctx context.Context, repositoryDir, revision string) (string, error) {
if revision == "" {
revision = "HEAD"
}
output, err := run(ctx, repositoryDir, nil, "rev-parse", "--verify", "--end-of-options", revision+"^{commit}")
if err != nil {
return "", fmt.Errorf("resolve selected revision: %w", err)
}
commit := strings.TrimSpace(output)
if !validObjectID(commit) {
return "", fmt.Errorf("selected revision did not resolve to a full commit ID")
}
return commit, nil
}
// CheckTaggerIdentity checks Git's native committer identity without creating a tag.
func CheckTaggerIdentity(ctx context.Context, directory string) error {
if _, err := run(ctx, directory, nil, "var", "GIT_COMMITTER_IDENT"); err != nil {