Skip to content

devops: scope the -diff gitattribute to the minified highlight.js - #6323

Merged
max-sixty merged 1 commit into
mainfrom
chore/gitattributes-highlight-js-path
Sep 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
chore/gitattributes-highlight-js-path

Conversation

@prql-bot

Copy link
Copy Markdown
Collaborator

.gitattributes marks highlight.js -diff to keep mdbook's 116KB single-line minified bundle out of git grep and git diff output. Git matches a pattern with no / against the basename at any depth, so it also matches grammars/prql-lezer/src/highlight.js — 45 lines of hand-written source added in #6307. Every change to that file renders as Binary files … differ, locally and in GitHub's PR view, so its diff is invisible to review.

Spelling out web/book/theme/highlight.js keeps the minified bundle suppressed and restores the source file's diff. The neighbouring package-lock.json entry is unanchored for the opposite reason — the repo has several of them and they should all be suppressed — so it stays as it is.

Verification

git check-attr on this branch, with web/book/theme/highlight.js still carrying diff: unset and the lezer source no longer doing so:

$ git check-attr -a web/book/theme/highlight.js grammars/prql-lezer/src/highlight.js
web/book/theme/highlight.js: diff: unset
web/book/theme/highlight.js: text: auto
web/book/theme/highlight.js: eol: lf
grammars/prql-lezer/src/highlight.js: text: auto
grammars/prql-lezer/src/highlight.js: eol: lf

Replaying #6307's own commit shows what review missed at the time:

$ # on main
$ git diff 800d919d^..800d919d -- grammars/prql-lezer/src/highlight.js
diff --git a/grammars/prql-lezer/src/highlight.js b/grammars/prql-lezer/src/highlight.js
index 068b8a78..06505ff2 100644
Binary files a/grammars/prql-lezer/src/highlight.js and b/grammars/prql-lezer/src/highlight.js differ

$ # on this branch
$ git diff 800d919d^..800d919d -- grammars/prql-lezer/src/highlight.js
diff --git a/grammars/prql-lezer/src/highlight.js b/grammars/prql-lezer/src/highlight.js
index 068b8a78..06505ff2 100644
--- a/grammars/prql-lezer/src/highlight.js
+++ b/grammars/prql-lezer/src/highlight.js
@@ -1,7 +1,14 @@
 import { styleTags, tags as t } from "@lezer/highlight";
...

No regression test: .gitattributes is git configuration with no code path to exercise, and git check-attr is the only assertion available.

@max-sixty
max-sixty merged commit 1e4ccc4 into main Sep 15, 2026
32 checks passed
@max-sixty
max-sixty deleted the chore/gitattributes-highlight-js-path branch September 15, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants