git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: brian m. carlson
Message 2 of 2 in “Acceptability of replacing .git internals with symlinks”
  1. brian m. carlsonApr 24, 2025
  2. Junio C HamanoApr 24, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.