build(uv-cli): Set correct gitdir and head path for worktree
Summary
Resolves #6196 .
Test Plan
Run cargo check multiple times within the worktree and inspect the outputs. There should be no Compiling message after the first check.
Some related info:
:) tree /Users/eth/workspace/astral-sh -L 1
/Users/eth/workspace/astral-sh/
├── uv/
└── uv-dev/
(devshell) :) git worktree list
/Users/eth/workspace/astral-sh/uv 20ef94b15 [main]
/Users/eth/workspace/astral-sh/uv-dev 3c313126b [uv-cli-worktree]
content of .git file in worktree:
(devshell) :) /bin/cat /Users/eth/workspace/astral-sh/uv-dev/.git
gitdir: /Users/eth/workspace/astral-sh/uv/.git/worktrees/uv-dev
content of HEAD of worktree:
(devshell) :) /bin/cat /Users/eth/workspace/astral-sh/uv/.git/worktrees/uv-dev/HEAD
ref: refs/heads/uv-cli-worktree
content of commondir of worktree:
(devshell) :) /bin/cat /Users/eth/workspace/astral-sh/uv/.git/worktrees/uv-dev/commondir
../..
cc @charliermarsh can you actually review this since you use worktrees?
Sure, no prob.
@eth3lbert I just merged #6825. I ended up submitting that before realizing this PR or #6196 existed. I merged that one over this one because I liked having the logic split out into a separate function. But this overall looked good too. Apologies for the duplicated effort and thank you for noticing this problem and submitting a fix. :-)
@eth3lbert I just merged #6825. I ended up submitting that before realizing this PR or #6196 existed. I merged that one over this one because I liked having the logic split out into a separate function. But this overall looked good too. Apologies for the duplicated effort and thank you for noticing this problem and submitting a fix. :-)
All good, thanks!