(Updated according to the latest test code to make it easier to read)
It seems that AlternateFS doesn't work with git's clone --shared when the origin is also a "shared" one. For example:
-
There is a repo /tmp/repo-origin
-
Then "clone --shared" to /tmp/repo-clone1
-
Then "clone --shared" from "clone1" to /tmp/repo-clone2
-
Trying to set altRepoPath to /tmp/repo-origin or /tmp/repo-clone1
-
If I use osfs.New(altRepoPath, osfs.WithChrootOS())
- then
func (d *DotGit) Alternates() changes the path to ../repo-clone1/objects or objects, which doesn't exist, then Alternates returns error.
-
If I use osfs.New(altRepoPath, osfs.WithBoundOS())
- then
func (d *DotGit) Alternates() tries to use path /tmp/repo-clone1/objects, which doesn't exist, then Alternates returns error.
The only working approach is: AlternativeFS: osfs.New("/")