Fix error at first commit, show pager link
gitile/pages.scm
1 | 1 | ;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu> | |
2 | + | ;;;; Copyright (C) 2024 Evgeny Pisemsky <mail@pisemsky.site> | |
2 | 3 | ;;;; | |
3 | 4 | ;;;; SPDX-License-Identifier: AGPL-3.0-or-later | |
4 | 5 | ;;;; | |
… | |||
218 | 219 | commits) | |
219 | 220 | ,(if next | |
220 | 221 | `(p (a (@ (href "/" ,repository-name "/commits/" | |
221 | - | ,(oid->string (commit-id next)))))) | |
222 | + | ,(oid->string (commit-id next)))) | |
223 | + | "Next")) | |
222 | 224 | '())))) | |
223 | 225 | ||
224 | 226 | (define (parent-paths-box repository-name ref path) | |
… | |||
268 | 270 | ||
269 | 271 | (define (project-commit repository-name repo ref) | |
270 | 272 | (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)))) | |
273 | 276 | `(,(commit-infobox repository-name commit #:open? #t) | |
274 | 277 | (p (@ (class "commit-summary")) ,(commit-message commit)) | |
275 | 278 | ,(diff-box diff)))) |