From: Lady Date: Fri, 28 Jul 2023 08:38:33 +0000 (-0700) Subject: Fix old recently changed files X-Git-Tag: 0.1.2 X-Git-Url: https://git.ladys.computer/GitWikiWeb/commitdiff_plain/d313efa8654774a2dd84e1b7a372d02425360782?ds=sidebyside;hp=d6baabd2ed44753aa5220830aae7741bd2cf8c28 Fix old recently changed files The final comparison should be between the old commit and HEAD, not between the old commit and its parent. --- diff --git a/build.js b/build.js index b0df7c0..df9c016 100644 --- a/build.js +++ b/build.js @@ -173,7 +173,7 @@ const listOfInternalLinks = (references, wrapper = ($) => $) => ({ ), }); -const diffReferences = async (hash) => { +const diffReferences = async (hash, againstHead = false) => { const diff = new Deno.Command("git", { args: [ "diff-tree", @@ -182,7 +182,7 @@ const diffReferences = async (hash) => { "--name-only", "--no-renames", "--diff-filter=AM", - hash, + ...(againstHead ? [hash, "HEAD"] : [hash]), ], stdout: "piped", stderr: "piped", @@ -692,7 +692,9 @@ class GitWikiWebPage { ]).then(logErrorsAndCollectResults); const refs = []; current = hash; - for (const ref of (await diffReferences(current))) { + for ( + const ref of (await diffReferences(current, !recency)) + ) { if (seen.has(ref)) { /* do nothing */ } else { @@ -700,7 +702,7 @@ class GitWikiWebPage { seen.add(ref); } } - results[recency] = { dateTime, humanReadable, refs }; + results[recency] = { dateTime, hash, humanReadable, refs }; } while (recency-- > 0 && current && current != commit); return results; })(),