Fix error at first commit, show pager link

Evgeny PisemskyTue Aug 20 10:00:45+0300 2024

ebf0c3b

Fix error at first commit, show pager link

gitile/pages.scm

11
;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu>
2+
;;;; Copyright (C) 2024 Evgeny Pisemsky <mail@pisemsky.site>
23
;;;;
34
;;;; SPDX-License-Identifier: AGPL-3.0-or-later
45
;;;;

218219
            commits)
219220
      ,(if next
220221
           `(p (a (@ (href "/" ,repository-name "/commits/"
221-
                           ,(oid->string (commit-id next))))))
222+
                           ,(oid->string (commit-id next))))
223+
                  "Next"))
222224
           '()))))
223225
224226
(define (parent-paths-box repository-name ref path)

268270
269271
(define (project-commit repository-name repo ref)
270272
  (let* ((commit (get-commit repo ref))
271-
         (parent (commit-parent commit))
272-
         (diff (diff-tree-to-tree repo (commit-tree parent) (commit-tree commit))))
273+
         (parent (false-if-exception (commit-parent commit)))
274+
         (tree-of-parent (if parent (commit-tree parent) (pointer->tree %null-pointer)))
275+
         (diff (diff-tree-to-tree repo tree-of-parent (commit-tree commit))))
273276
    `(,(commit-infobox repository-name commit #:open? #t)
274277
      (p (@ (class "commit-summary")) ,(commit-message commit))
275278
      ,(diff-box diff))))