Skip to content

fix: build.rs rerun-if-changed watches wrong paths in worktrees#303

Merged
avihut merged 1 commit intomasterfrom
fix/build-rs-rerun-cache
Mar 15, 2026
Merged

fix: build.rs rerun-if-changed watches wrong paths in worktrees#303
avihut merged 1 commit intomasterfrom
fix/build-rs-rerun-cache

Conversation

@avihut
Copy link
Owner

@avihut avihut commented Mar 15, 2026

Summary

  • In git worktrees, git rev-parse --git-dir returns a worktree-specific path (.git/worktrees/<name>/) but loose refs and tags live in the common git dir (.git/). The build script watched ref paths under the worktree git-dir where the files don't exist, so it never re-ran when new commits were made.
  • This caused daft_dev_build cfg to become stale: if the initial build happened on a tagged release commit (e.g., v1.1.0), subsequent builds on untagged branch commits still thought they were release builds, breaking DAFT_CONFIG_DIR override and its unit tests.
  • Fix: use --git-common-dir for loose ref and packed-refs paths.

Test plan

  • cargo clean -p daft && cargo test --lib passes all 636 tests
  • After building on tagged commit then committing (without cargo clean), build script re-runs and daft_dev_build is correctly set
  • CI lint + unit tests pass

🤖 Generated with Claude Code

In git worktrees, `git rev-parse --git-dir` returns a worktree-specific
path (e.g., `.git/worktrees/<name>/`) but loose refs and tags live in
the common git dir (`.git/`). The build script was watching ref paths
under the worktree git-dir where the files don't exist, so it never
re-ran when new commits were made or tags changed.

This caused `daft_dev_build` cfg to become stale: if the initial build
happened on a tagged release commit, subsequent builds on untagged
branch commits would still think they were release builds, breaking
DAFT_CONFIG_DIR override and its tests.

Fix: use `--git-common-dir` for loose ref and packed-refs paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut added this to the Public Launch milestone Mar 15, 2026
@avihut avihut added the fix Bug fix label Mar 15, 2026
@avihut avihut self-assigned this Mar 15, 2026
@avihut avihut merged commit c321eff into master Mar 15, 2026
8 checks passed
@avihut avihut deleted the fix/build-rs-rerun-cache branch March 15, 2026 19:56
This was referenced Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant