aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_commit.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-31 16:59:18 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-31 16:59:18 +0800
commit655b6b211ae6df0186abd740f248939f7ddeaec1 (patch)
treeec5cdbbc52222f62c8fbb0bcf2a1aa7a9f6eb8b6 /http_handle_repo_commit.go
parentCorrect table headers in MR indices (diff)
downloadforge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.gz
forge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.zst
forge-655b6b211ae6df0186abd740f248939f7ddeaec1.zip
Add descriptive comments to most Go functions
Diffstat (limited to '')
-rw-r--r--http_handle_repo_commit.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go
index 7b967fa..338ef8d 100644
--- a/http_handle_repo_commit.go
+++ b/http_handle_repo_commit.go
@@ -16,14 +16,16 @@ import (
"go.lindenii.runxiyu.org/lindenii-common/misc"
)
-// The file patch type from go-git isn't really usable in HTML templates
-// either.
+// usableFilePatch is a [diff.FilePatch] that is structured in a way more
+// friendly for use in HTML templates.
type usableFilePatch struct {
From diff.File
To diff.File
Chunks []usableChunk
}
+// usableChunk is a [diff.Chunk] that is structured in a way more friendly for
+// use in HTML templates.
type usableChunk struct {
Operation diff.Operation
Content string
@@ -66,7 +68,7 @@ func httpHandleRepoCommit(writer http.ResponseWriter, request *http.Request, par
params["commit_object"] = commitObj
params["commit_id"] = commitIDStr
- parentCommitHash, patch, err = fmtCommitAsPatch(commitObj)
+ parentCommitHash, patch, err = commitToPatch(commitObj)
if err != nil {
errorPage500(writer, params, "Error getting patch from commit: "+err.Error())
return