LoadForStory fetches the git diff for a specific story's commit. If no commit is found, it shows a "not committed yet" message.
(storyID, title string)
| 49 | // LoadForStory fetches the git diff for a specific story's commit. |
| 50 | // If no commit is found, it shows a "not committed yet" message. |
| 51 | func (d *DiffViewer) LoadForStory(storyID, title string) { |
| 52 | d.storyID = storyID |
| 53 | |
| 54 | // Find the commit for this story (match both ID and title to avoid |
| 55 | // false positives from previous PRD runs with the same story IDs) |
| 56 | commitHash, err := git.FindCommitForStory(d.baseDir, storyID, title) |
| 57 | if err != nil || commitHash == "" { |
| 58 | d.noCommit = true |
| 59 | d.offset = 0 |
| 60 | d.loaded = true |
| 61 | d.err = nil |
| 62 | d.lines = nil |
| 63 | d.stats = "" |
| 64 | return |
| 65 | } |
| 66 | |
| 67 | d.noCommit = false |
| 68 | d.loadDiff(storyID, commitHash) |
| 69 | } |
| 70 | |
| 71 | // loadDiff loads a diff, either for a specific commit or the full branch. |
| 72 | func (d *DiffViewer) loadDiff(storyID, commitHash string) { |
no test coverage detected