Repository navigation
Closed
Labels
priority: highNeeds attention soon — not blocking, but don't let it sitstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: feature requestA request to add new functionality that does not currently exist
Description
Required behaviour (maintainer decision, 2026-10-04)
@Authoris the original author and is never changed unless explicitly forced (forceAuthorUpdate). Missing or unrecognised@Authorvalues may still be filled in.@Last modified byand@Last modified timerecord the last real edit to the file's content. Running fix-headers on a file whose content (everything outside the header) wasn't edited must not change either field, even when fix-headers rewrites other parts of the header: converting the date format (normalizeDateFormat), repairing an epoch, adding the frame/spacing/margin, fixing@Date(fixCreatedDate), filename, project name, copyright year, and so on. Example: converting2026-03-01 17:59:32 -08:00to2026-03-01T17:59:32-08:00must not change@Last modified byor@Last modified time.- When the content was edited,
@Last modified bybecomes the editor (the identity fix-headers detects for the run) and@Last modified timethe edit time. With that in place,forceLastModifiedAuthorUpdateshouldn't be needed for normal use.
Problem today
Any header change restamps @Last modified time. With useGpgSignerAuthor + forceAuthorUpdate + forceLastModifiedAuthorUpdate (the shared CLDMV config), whoever runs the tool also becomes @Author and @Last modified by of every file. Reproduced on 2026-10-04 in CLDMV/slothlet (CLDMV/slothlet#569): a dry run as Jane Contributor with no signing key would rewrite all 1150 headers' @Author and @Last modified by to Jane.
Implementation notes
- "Content edited" needs a definition that works in a writing run. Suggested: compare the file's body (header stripped) with the body at
HEAD(git show HEAD:<path>). If they differ, or the file isn't tracked yet, it was edited and gets restamped. If they're the same, keep the existing last-modified values, even if the header itself changes. Outside a git repo, fall back to the current behaviour. - Consider also using the last commit that changed the body (not only header lines) as the source when a header has no last-modified fields.
- Add tests covering: header-only normalisation with no restamp; a body edit restamping with the runner's identity;
@Authorpreserved for a different runner;forceAuthorUpdatestill replacing it; untracked/new files. - This changes output for every consumer, so it needs a release note.
Related: CLDMV/configs#15 (drop the force options from the shared config).
Metadata
Metadata
Assignees
Labels
priority: highNeeds attention soon — not blocking, but don't let it sitstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: feature requestA request to add new functionality that does not currently exist
Activity
[-]forceAuthorUpdate rewrites every file's @Author to whoever runs the tool; need a way to replace only known aliases[/-][+]Header-only rewrites must not touch @Last modified by/time; @Author is never changed unless forced[/+]Shinrai commentedon Oct 4, 2026
Correction from the maintainer to rule 2: a header-only rewrite still restamps
@Last modified time, because the file did change. It must not change@Last modified by.@Last modified time@Last modified by@AuthorfixCreatedDate, …)forceAuthorUpdate, or missing)Shinrai commentedon Oct 4, 2026
Final rule (maintainer, 2026-10-04), replacing the table above:
@Last modified bychanges only when the file itself was edited: its content differs from gitHEAD, or it's new or untracked. Every change fix-headers makes on its own (timestamp format, epoch,@Date, spacing/frame/margin, filename/project/copyright fields) restamps@Last modified timebut keeps@Last modified by.@Authoris unchanged unlessforceAuthorUpdateis set or it's missing.@Last modified time@Last modified by@AuthorShinrai commentedon Oct 4, 2026
Implemented in
33329b5onfeat/last-modified-content-edits, in PR #128 (#128) intonext.git show HEAD:<path>, orHEADdoesn't have the file (new, untracked, ignored, or no commits yet). Outside a git work tree there's nothing to compare against, so the recorded editor is kept.@Last modified bybecomes the run's identity only when the content was edited. Changes fix-headers makes to the header by itself (date format, epoch,fixCreatedDate, time zone conversion, frame/spacing/margin,@Project/@Filename/@Copyright) restamp@Last modified timeand keep the recorded editor.@Last modified timeis restamped whenever the header is rewritten. It also moves once for a new content edit by the editor already recorded: that happens when the body differs fromHEADand the recorded time is older than the file's last commit. Re-runs stay no-ops.@Author/@Emailare kept unlessforceAuthorUpdateis set, and filled in when missing.forceLastModifiedAuthorUpdatekeeps its old meaning: it writes the run identity on every file. It's documented as not needed for normal use.Tests are in
tests/last-modified-content-edit.test.vitest.mjs. They use real git repos, with the runner identity coming from a temporaryGIT_CONFIG_GLOBALthat has no signing key, anduseGpgSignerAuthoron. Coverage stays at 100%. The README has a new "Author and last modified" section with the behaviour table. The release note will go in the release-docs PR.Shinrai commentedon Oct 4, 2026
Clarification on requirement 2:
@Last modified timeis restamped whenever fix-headers rewrites a header, including a format-only conversion such asnormalizeDateFormat. That is intended: once the header has been rewritten, the time of that rewrite is the file's last modification, so keeping the old value would only make the next run change it anyway.What a header-only rewrite keeps is the recorded editor:
@Last modified by(and@Author/@Email) are unchanged unless the file's content outside the header was edited, orforceLastModifiedAuthorUpdate/forceAuthorUpdateis set. That is what shipped in #128 and what the v2.2.0 changelog and README describe.release: v2.2.0 - change @last modified by only when the file's content…