all repos — homestead @ 10f9fb2d61199a57ee12d443c2d2d55b858e467c

Code for my website

change post changelog link to point to file's diff

Alan Pearce
commit

10f9fb2d61199a57ee12d443c2d2d55b858e467c

parent

44ac8121f566c71b3672db6609792063c1bb06f9

1 file changed, 11 insertions(+), 0 deletions(-)

changed files
M internal/vcs/filelog.gointernal/vcs/filelog.go
@@ -19,6 +19,7 @@ Email string
} type Commit struct { + repo *Repository ShortHash string Hash string Message string
@@ -54,6 +55,7 @@ cs := make([]*Commit, 0)
err = fl.ForEach(func(c *object.Commit) error { summary, description, _ := strings.Cut(c.Message, "\n") cs = append(cs, &Commit{ + repo: r, ShortHash: c.Hash.String()[:hashLength], Hash: c.Hash.String(), Message: c.Message,
@@ -81,3 +83,12 @@
func cleanupDescription(description string) string { return strings.TrimSpace(rewrap.ReplaceAllString(description, " $1")) } + +func (c *Commit) MakeFileLink(filename string) *url.URL { + u := c.repo.remoteURL.JoinPath("commit").JoinPath(filename) + q := u.Query() + q.Add("id", c.Hash) + u.RawQuery = q.Encode() + + return u +}