Capture diagnostic identities and rehearsal records
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user