Re: Acceptability of replacing .git internals with symlinks
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 24, 2025, 23:05 UTC
- Message-ID
- <xmqqwmb9rwhh.fsf@gitster.g>
- In-Reply-To
- <aAq7_7pFTToMPX48@tapette.crustytoothpaste.net>
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> I know symlinking the `hooks` directory is common and semi-suppported, > but I don't know how we feel about other directories, such as `objects`.
I do not know how widely it is used, but the git-new-workdir script we ship in contrib/workdir/ does make symlinks from a new directory whose name is ".git" into subdirectories of an existing $GIT_DIR/ to pretend as if the "new-workdir" is a separate Git repository, that happens to share many files and directories like config, refs, objects, etc.
I do not think we ever intended to support ".git" itself being a symbolic link to ".git" directory owned by another repository. We do have ".git" that is a regular file for multiple worktree support, but that is totally different from "just making a symlink for the whole hierarchy".
> If we _do_ want to support this, then we should probably add some tests > for it, and if we don't, then we may want to add advice or diagnostics > to discourage this behaviour.
100% agreed.