MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / FindCommitForStory

Function FindCommitForStory

internal/git/git.go:155–164  ·  view source on GitHub ↗

FindCommitForStory searches the git log for a commit whose subject line matches the chief commit format "feat: - ". Both the story ID and title are required to avoid false positives from previous PRD runs that may reuse the same story IDs. Returns the commit hash if found, empty str

(dir, storyID, title string)

Source from the content-addressed store, hash-verified

153// previous PRD runs that may reuse the same story IDs.
154// Returns the commit hash if found, empty string otherwise.
155func FindCommitForStory(dir, storyID, title string) (string, error) {
156 cmd := exec.Command("git", "log", "--fixed-strings", "--grep=feat: "+storyID+" - "+title, "--format=%H", "-1")
157 cmd.Dir = dir
158 output, err := cmd.Output()
159 if err != nil {
160 return "", err
161 }
162 hash := strings.TrimSpace(string(output))
163 return hash, nil
164}
165
166// getMergeBase returns the merge base commit between two refs.
167func getMergeBase(dir, ref1, ref2 string) (string, error) {

Callers 1

LoadForStoryMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected