Page MenuHomePhabricator

Find the per-worktree .git directory when using git-worktree
AbandonedPublic

Authored by arichardson on Aug 11 2020, 3:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 18, 2:55 PM
Unknown Object (File)
Mon, Apr 8, 6:33 PM
Unknown Object (File)
Sat, Mar 30, 9:37 AM
Unknown Object (File)
Fri, Mar 29, 7:18 PM
Unknown Object (File)
Fri, Mar 29, 5:03 PM
Unknown Object (File)
Thu, Mar 28, 11:53 PM
Unknown Object (File)
Wed, Mar 27, 2:00 AM
Unknown Object (File)
Mar 19 2024, 1:52 AM
Subscribers

Details

Summary

When using git-worktree, $vcs_root/.git is not a directory but a file and
this breaks e.g. arc get-config/set-config. To handle this case we can
use git rev-parse --git-dir to get the per-worktree .git directory.

Test Plan

arc set-config --local history.immutable false failed inside a git worktree before, now it writes the value and arc get-config returns the new value.

Diff Detail

Repository
rARC Arcanist
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 24831
Build 34257: arc lint + arc unit

Event Timeline

There's currently no customer interest in worktree support. The use cases in T9924 seem flimsy to me so I don't currently plan to support worktrees in the absence of customer interest. See also ArcanistGitWorkingCopy.

I don't expect any sophisticated git-worktree support. This is a simple change that allows arc get-config/set-config to work correctly when invoked from a worktree. It might also fix some other cases where arc expects $identity->localMetaDir to be a directory which previously wasn't the case for worktrees.

I don't believe this is related to T9924 and I would be very unhappy if that behaviour was implemented. I rely on my worktrees remaining available at all times. I work on multiple projects with very large .git directory that are forked from the same root project so I use worktrees to save disk space and allow cherry-picking between the different forks, not as arc "feature branches".

To be completely clear: I'm not going to accept any features upstream which zero customers are interested in. It doesn't matter if they're simple or complicated. If no customers want it, it isn't coming upstream.