uv icon indicating copy to clipboard operation
uv copied to clipboard

build(uv-cli): Set correct gitdir and head path for worktree

Open eth3lbert opened this issue 1 year ago • 3 comments

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.

eth3lbert avatar Aug 19 '24 03:08 eth3lbert

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 
../..

eth3lbert avatar Aug 19 '24 04:08 eth3lbert

cc @charliermarsh can you actually review this since you use worktrees?

zanieb avatar Aug 23 '24 23:08 zanieb

Sure, no prob.

charliermarsh avatar Aug 23 '24 23:08 charliermarsh

@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. :-)

BurntSushi avatar Aug 29 '24 18:08 BurntSushi

@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!

eth3lbert avatar Aug 29 '24 18:08 eth3lbert