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
F14352574: D21438.diff
Thu, Dec 19, 1:56 PM
Unknown Object (File)
Tue, Dec 17, 11:57 PM
Unknown Object (File)
Mon, Dec 16, 4:14 AM
Unknown Object (File)
Wed, Dec 4, 2:08 AM
Unknown Object (File)
Thu, Nov 28, 9:01 PM
Unknown Object (File)
Wed, Nov 27, 3:40 AM
Unknown Object (File)
Nov 19 2024, 11:33 AM
Unknown Object (File)
Nov 15 2024, 11:35 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.