* Acceptability of replacing .git internals with symlinks
@ 2025-04-24 22:32 brian m. carlson
2025-04-24 23:05 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: brian m. carlson @ 2025-04-24 22:32 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 1574 bytes --]
Git LFS has gotten a couple of bug reports[0][1] about it failing when
some of the innards of the `.git` directory are replaced with symlinks.
This happens because the Android `repo` tool creates repositories this
way; why that is, I don't know.
I know _part_ of the problem for Git LFS is due to the fact that some
operations are run under, say, `.git/objects`, and if that's a symlink
then the path canonicalization puts the directory elsewhere and the
`.git` directory detection fails. I don't know if that's all of the
problem, or just part of it.
My inquiry here is whether we consider it acceptable for tools to create
symlinks from Git internals in this way and whether this is a thing that
should be fixed or not. I haven't tested with alternate Git
implementations, such as JGit, Game of Trees, dulwich, libgit2, or
others, so I don't know how gracefully they handle this. I will assume
for the sake of discussion that the symlinks can be created successfully
without elevated permissions and the OS and file system are fully
functional in this regard.
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`.
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.
[0] https://github.com/git-lfs/git-lfs/issues/5426
[1] https://github.com/git-lfs/git-lfs/issues/603
--
brian m. carlson (they/them)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 325 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Acceptability of replacing .git internals with symlinks
2025-04-24 22:32 Acceptability of replacing .git internals with symlinks brian m. carlson
@ 2025-04-24 23:05 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2025-04-24 23:05 UTC (permalink / raw)
To: brian m. carlson; +Cc: git
"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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-24 23:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 22:32 Acceptability of replacing .git internals with symlinks brian m. carlson
2025-04-24 23:05 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).