Fix "Updated:" date showing the wrong date on wiki pages#1323
Closed
Fix "Updated:" date showing the wrong date on wiki pages#1323
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The "Updated:" date at the bottom of most wiki pages shows the date of the last commit to the entire repo, rather than the date the specific page was last modified.
Root Cause
The wiki uses the
jekyll-last-modified-atplugin to determine each page's last-modified date. This plugin works by runninggit log -n 1 --format="%ct" -- <path>to find the most recent commit that touched a given file.The Jekyll build runs inside a Docker container, and the
.gitdirectory is copied into the image via the Dockerfile'sADDcommand. However, GitLab CI performs a shallow clone by default (limited commit history). With a shallow clone, git sees the single available commit as having introduced every file, sogit log -n 1 -- <any-file>returns the same date for all pages — the date of the most recent commit to the repo.Fix
Added
GIT_DEPTH: 0to thebuildjob in.gitlab-ci.yml. This tells GitLab CI to perform a deep clone, giving thejekyll-last-modified-atplugin access to the complete git history so it can correctly determine the last commit that touched each individual file.