Skip to content

Guard lint.mk's submodule include so it doesn't break tarball builds - #37

Open
jnasbyupgrade wants to merge 1 commit into
masterfrom
fix-lint-tarball-build
Open

Guard lint.mk's submodule include so it doesn't break tarball builds#37
jnasbyupgrade wants to merge 1 commit into
masterfrom
fix-lint-tarball-build

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Collaborator

Summary

From `~/test-fixes.md` item #12 (found in `cat_tools`): an unconditional `include` of a submodule-vendored `.mk` file with a self-init rule breaks every `make` invocation, not just the feature it wires up, when building from a source tarball (`git archive`, PGXN's own `make dist` output) rather than a real git checkout.

test_factory has this exact pattern: `Makefile` does `include lint.mk`, and `lint.mk` does `include .vendor/linter/lint.mk` with a self-init rule (`git submodule update --init`). Make tries to satisfy every `include` before doing anything else, for any target requested. A real distribution tarball has no `.git` and no submodule content, so `git submodule update` fails immediately (`fatal: not a git repository`), and that failure aborted the entire build -- `make`, `make install`, everything, not just `make lint`.

Confirmed, not assumed

Built a real tarball (`git archive` of current `master`) into a clean directory with no `.git` at all:

  • Before this fix: plain `make` failed immediately, exit code 2, `fatal: not a git repository`.
  • After this fix: plain `make` succeeds (exit 0), `make install` succeeds (exit 0), and `make lint` there now fails with Make's own clean `No rule to make target 'lint'` -- a specific, targeted failure only when lint is actually requested, instead of aborting every target.

Also confirmed the fix doesn't regress the normal case: from a real git checkout, both `make lint` (submodule auto-inits exactly as before) and a plain `make` still succeed.

Fix

Guard the self-init rule and the submodule `include` behind `ifneq ($(wildcard .git),)`. Outside a real git checkout, lint support is simply unavailable -- nothing else in the build needs it.

Test plan

  • Real git checkout: `make lint` still works
  • Real git checkout: plain `make` still works
  • Tarball (`git archive`, no `.git`): plain `make` now succeeds (previously failed)
  • Tarball: `make install` succeeds
  • Tarball: `make lint` fails gracefully (`No rule to make target`) instead of aborting everything

🤖 Generated with Claude Code

An unconditional `include .vendor/linter/lint.mk` (via the self-init rule
`git submodule update --init`) breaks EVERY make invocation -- not just
`make lint` -- when building from a source tarball. Make tries to satisfy
every `include` before doing anything else, for any target requested; a
real PGXN distribution tarball (git archive, make dist's own output) has no
.git and no submodule content, so `git submodule update` fails outright
("fatal: not a git repository"), and that failure aborted the whole build.

Confirmed by building a real `git archive` tarball into a clean directory
with no .git at all: a plain `make` failed immediately with
"fatal: not a git repository" before doing anything else, real exit code 2.

Fix: guard the self-init rule and include behind `ifneq ($(wildcard
.git),)`. Confirmed both directions: a real git checkout still runs `make
lint` successfully (submodule auto-inits as before) and a plain `make`
still succeeds there too; the same tarball now builds successfully with a
plain `make`, and `make lint` there fails with Make's own "no rule to make
target" instead of aborting every target.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a0f261c1-3f17-4d7a-9b11-1e51051845b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant