-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use git log to know a documents last modified date #706
Comments
@Gregoor and I dug into this early in Jan 2020 and we managed to write an "algorithm" that uses What we stumbled on was that |
I'm going to wait for #1510 because I know it has a nifty wrapper on @fiji-flo Had an interesting idea. We could potentially control that jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cache git log JSON
id: cache-git-log
uses: actions/cache@v2
with:
path: git-log.json
key: ${{ runner.os }}-git-log.json
- uses: actions/checkout@v2
with:
fetch-depth: ${{ steps.cache-git-log.outputs.cache-hit == 'true' && 100 || 0 }}
- name: Build Yari
...
- name: Dump git-log.json
run: node cli.js dump-git-log-past -o git-log.json |
Ugh. I’m struggling to figure out how to get the last-modified date. I think we might need to accept that all last-modified dates come from git. Every single document (we build) is in git. So for every single filepath, we'll have a date and it'll be the last time it got checked in. So if a document, in the Wiki, was last modified in 2019-05-10, it won't be anymore because it'll be something from either the first time we ran the migration (the creation of the mdn/content repo) or the final migration, or if it has changed in github since the final migration. It'll never be anything older than that. In other words, we're going to lose the last-modified from before the migration. You'll never see, in the document footer: "Last modified: July 21, 2019" Given the
If you merge these it has to become
Some documents have not had any read edits to them since they migration, but how can you possibly know?? And if we run some fixable flaws mass-edits, it'll still look like even more edits in it. So I think the conclusion is pretty solid. We'll have to give up on last-modified dates that predate the migration(s). |
One repercussion is; we can probably stop recording the |
In case it helps: In 11ty/eleventy#142 (comment) I digged into how to get the last modified date for all files known to git. |
@peterbe I wonder if we could solve this by always using the |
Doable, but I don't like it. The problem is that we've been migrating from Wiki to github.com/mdn/content for over a month now. I've already done 5 checkins for content from MySQL and I hope to do many more in the next couple of weeks. The other secret truth is that a lot of "last modified" dates in the Wiki are quite invalid because it could be bots that just trigger an edit to a document rather than a new revision creation. One option is that we display both dates. E.g.
The other not so secret truth is that a LOT of document has fixable flaws. Either it's external images or it's broken links that are fixable. So a huge amount of documents will have a git last-modified date like Dec 15, 2020. Should we make an exception for that too? It's getting complicated. |
git log --name-only --grep="^Bump " --invert-grep --no-decorate --format="←→ %ci" --date-order --after="2020-10-01 00:00:00 -0000" --reverse We should come up with a convention for non-content commits and put that into the That might be a solution to all of this. |
By the way, the way we compute last-modified in the dumper is wrong. Very wrong. Obviously, it's not that simple. Without taking the time to carefully study the Kuma Wiki ORM code, it's very possible that sometimes a document legitimately is modified since the latest revision was created. For example, when you edit other things such as slug, title, revision adjustments. Note-to-self; this was the query I used to deduce these percentages: select max(r.created) as max_created, d.id, d.modified from
wiki_revision r
INNER JOIN wiki_document d ON r.document_id = d.id
where d.locale = 'en-us'
group by r.document_id |
#699 Trigger focus when main topbar search is opened
At the time of writing, we're only using the
.modified
date in the sitemaps XML files we build at the end of the builder. But we should really soon have a "last modified" displayed in the footer of every document.For documents that have been imported from MySQL we get this from the
wikihistory.json
but not for documents that came into existence after the MySQL import.The text was updated successfully, but these errors were encountered: