From 655b6b211ae6df0186abd740f248939f7ddeaec1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 16:59:18 +0800 Subject: Add descriptive comments to most Go functions --- http_handle_repo_commit.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'http_handle_repo_commit.go') 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 -- cgit v1.2.3