From: Lady Date: Fri, 28 Jul 2023 08:38:33 +0000 (-0700) Subject: Fix old recently changed files X-Git-Tag: 0.1.2^0 X-Git-Url: https://git.ladys.computer/GitWikiWeb/commitdiff_plain/50f9a55cd48d652f15a913237c166af00e554186 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; })(),