MCPcopy Create free account
hub / github.com/JanSmrcka/differ / loadCommitDiff

Method loadCommitDiff

internal/ui/log.go:118–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116}
117
118func (m LogModel) loadCommitDiff() tea.Cmd {
119 commit := m.commits[m.cursor]
120 repo := m.repo
121 styles := m.styles
122 t := m.theme
123 width := m.width
124
125 return func() tea.Msg {
126 raw, err := repo.CommitDiff(commit.Hash)
127 if err != nil {
128 return logDiffLoadedMsg{content: "Error: " + err.Error(), hash: commit.Hash}
129 }
130 // Guess filename from diff headers for syntax highlighting
131 content := renderCommitDiff(raw, styles, t, width)
132 return logDiffLoadedMsg{content: content, hash: commit.Hash}
133 }
134}
135
136// renderCommitDiff renders a full commit diff (may contain multiple files).
137func renderCommitDiff(raw string, styles Styles, t theme.Theme, width int) string {

Callers 1

updateListMethod · 0.95

Calls 2

renderCommitDiffFunction · 0.85
CommitDiffMethod · 0.80

Tested by

no test coverage detected