BlueGit

timfa bluegit

Files

bluegit / internal / gitrepo / committer.go

committer.go

fix: gebruik de committer-tijd als AUR-pkgver
timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa · 3 weeks ago
2388e414 History
committer.go 565 B Download Raw
1package gitrepo
2
3import (
4 "context"
5 "fmt"
6 "strings"
7)
8
9// CommitterTimestamp is de committer-tijd van sha in ISO 8601 (%cI).
10// Dat is dezelfde tijd als CI_COMMIT_TIMESTAMP.
11func CommitterTimestamp(ctx context.Context, gitBin, dir, sha string) (string, error) {
12 if sha == "" {
13 return "", fmt.Errorf("sha ontbreekt")
14 }
15 out, err := run(ctx, gitBin, nil, "-C", dir, "show", "-s", "--format=%cI", sha)
16 if err != nil {
17 return "", err
18 }
19 stamp := strings.TrimSpace(out)
20 if stamp == "" {
21 return "", fmt.Errorf("geen committer-tijd")
22 }
23 return stamp, nil
24}