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
F15466320: D21438.diff
Thu, Apr 3, 4:14 AM
F15458332: D21438.diff
Sun, Mar 30, 11:04 PM
F15416112: D21438.id51014.diff
Thu, Mar 20, 9:20 AM
F15403569: D21438.diff
Tue, Mar 18, 3:55 AM
F15400450: D21438.id51016.diff
Mon, Mar 17, 11:43 AM
F15398212: D21438.diff
Sun, Mar 16, 11:48 PM
F15392998: D21438.diff
Sat, Mar 15, 6:48 PM
F15387269: D21438.id.diff
Sat, Mar 15, 2:08 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.