MCPcopy Create free account
hub / github.com/temporalio/temporal / commitOrder

Function commitOrder

tools/flakereport/git.go:14–40  ·  view source on GitHub ↗

commitOrder returns commit SHAs between oldSHA (exclusive) and HEAD (inclusive), in chronological order (oldest first). Shells out to: git log --reverse --format=%H ..HEAD

(ctx context.Context, oldSHA string)

Source from the content-addressed store, hash-verified

12// in chronological order (oldest first).
13// Shells out to: git log --reverse --format=%H <oldSHA>..HEAD
14func commitOrder(ctx context.Context, oldSHA string) ([]string, error) {
15 ctxTimeout, cancel := context.WithTimeout(ctx, 30*time.Second)
16 defer cancel()
17
18 cmd := exec.CommandContext(ctxTimeout, "git", "log",
19 "--reverse",
20 "--format=%H",
21 fmt.Sprintf("%s..HEAD", oldSHA),
22 )
23
24 output, err := cmd.Output()
25 if err != nil {
26 if exitErr, ok := err.(*exec.ExitError); ok {
27 return nil, fmt.Errorf("git log failed: %w\nstderr: %s", err, string(exitErr.Stderr))
28 }
29 return nil, fmt.Errorf("failed to run git log: %w", err)
30 }
31
32 var commits []string
33 for line := range strings.SplitSeq(strings.TrimSpace(string(output)), "\n") {
34 line = strings.TrimSpace(line)
35 if line != "" {
36 commits = append(commits, line)
37 }
38 }
39 return commits, nil
40}

Callers 1

runBisectAnalysisFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected