Guard the vendored linter include so tarball builds don't break - #80
Conversation
The top-level Makefile's `include lint.mk` is unconditional, so Make tries to satisfy every include this file pulls in before running any target at all, for any target. lint.mk auto-initializes the .vendor/linter submodule via a rule for .vendor/linter/lint.mk, then includes it. git archive (what `make dist` uses, and what PGXN ships to real consumers) never includes submodule content and strips .git entirely, so in a tarball extracted from a release archive, `git submodule update --init` fails immediately (not a git repository), aborting the include and the entire Makefile parse -- breaking `make`, `make install`, everything, not just `make lint`. Wrap the auto-init rule and the vendored include in `ifneq ($(wildcard .git),)`, so a tarball build (no .git at all) never even asks Make to look for .vendor/linter/lint.mk, and the auto-remake rule never fires. $(wildcard .git) matches both a real .git directory (plain clone) and the .git file pointer used inside a git worktree, so normal checkouts are unaffected and `make lint` keeps working exactly as before. `make lint` becoming unavailable in a tarball build is expected -- PGXN consumers don't need the linter.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @jnasbyupgrade's task in 1m 49s —— View job Review: Guard the vendored linter include so tarball builds don't break
Verdict: LGTM. The fix is correct, minimal, and well-targeted. What I checked
No functional, security, or style issues found. |
lint.mk's vendored include is now guarded on $(wildcard .git) so a source tarball with no .git can still build. If that guard ever went false in CI (checkout somehow left no .git), `lint` wouldn't exist as a make target, and `make lint` fails loudly rather than silently skipping -- but only if CI actually invokes that exact command with nothing swallowing its exit code. Document that constraint at the call site so it isn't accidentally routed through a wrapper or a different entry point later.
|
Claude finished @jnasbyupgrade's task in 1m 59s —— View job Code Review: Guard the vendored linter include so tarball builds don't break
Verdict: LGTM. This review covers both commits, including
|
The top-level Makefile's
include lint.mkis unconditional, so Make tries to satisfy every include this file pulls in before running any target at all, for any target. lint.mk auto-initializes the .vendor/linter submodule via a rule for.vendor/linter/lint.mk, then includes it.git archive(whatmake distuses, and what PGXN ships to real consumers) never includes submodule content and strips.gitentirely, so in a tarball extracted from a release archive,git submodule update --initfails immediately (not a git repository), aborting the include and the entire Makefile parse -- breakingmake,make install, everything, not justmake lint.Wrap the auto-init rule and the vendored include in
ifneq ($(wildcard .git),), so a tarball build (no.gitat all) never even asks Make to look for.vendor/linter/lint.mk, and the auto-remake rule never fires.$(wildcard .git)matches both a real.gitdirectory (plain clone) and the.gitfile pointer used inside a git worktree, so normal checkouts are unaffected andmake lintkeeps working exactly as before.make lintbecoming unavailable in a tarball build is expected -- PGXN consumers don't need the linter.Verification
cat_tools-0.3.0.ziprelease archive (git archiveof tag0.3.0) into a directory with no.gitat all, andmakefailed immediately with the submodule init error, before doing anything else.git archive --prefix=cat_tools-test/ -o /tmp/cat_tools-test.zip HEAD, extracted into a clean directory outside any git repo --makeandmake installboth succeed with no.gitpresent.make lintstill works exactly as before.make verify-resultspasses, confirming the normal test suite is unaffected.No HISTORY.asc entry -- this is purely internal build tooling, not a user-facing behavior change.