aboutsummaryrefslogtreecommitdiff
path: root/handle_repo_commit.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-11 23:48:39 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-11 23:48:39 +0800
commit0fbcf9737eeaafcac72ed8dbce3035ac292fc68c (patch)
tree9de471ddbba1be583575ffea40e98c01b968f759 /handle_repo_commit.go
parentrepo_commit: Don't crash when viewing the first commit (diff)
downloadforge-0fbcf9737eeaafcac72ed8dbce3035ac292fc68c.tar.gz
forge-0fbcf9737eeaafcac72ed8dbce3035ac292fc68c.tar.zst
forge-0fbcf9737eeaafcac72ed8dbce3035ac292fc68c.zip
repo_commit: Reformat
Diffstat (limited to 'handle_repo_commit.go')
-rw-r--r--handle_repo_commit.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/handle_repo_commit.go b/handle_repo_commit.go
index 5f7d495..af04d69 100644
--- a/handle_repo_commit.go
+++ b/handle_repo_commit.go
@@ -6,9 +6,9 @@ import (
"strings"
"github.com/go-git/go-git/v5/plumbing"
- "github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/filemode"
"github.com/go-git/go-git/v5/plumbing/format/diff"
+ "github.com/go-git/go-git/v5/plumbing/object"
"go.lindenii.runxiyu.org/lindenii-common/misc"
)
@@ -71,7 +71,7 @@ func handle_repo_commit(w http.ResponseWriter, r *http.Request) {
return
} else {
data["parent_commit_hash"] = parent_commit_object.Hash.String()
-
+
patch, err = parent_commit_object.Patch(commit_object)
if err != nil {
_, _ = w.Write([]byte("Error getting patch of commit: " + err.Error()))
@@ -111,15 +111,19 @@ type fake_diff_file struct {
mode filemode.FileMode
path string
}
+
func (f fake_diff_file) Hash() plumbing.Hash {
return f.hash
}
+
func (f fake_diff_file) Mode() filemode.FileMode {
return f.mode
}
+
func (f fake_diff_file) Path() string {
return f.path
}
+
var fake_diff_file_null = fake_diff_file{
hash: plumbing.NewHash("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"),
mode: misc.First_or_panic(filemode.New("100644")),