You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to open a repository that is a submodule and it is failing as it expects .git to be a directory, not a reference to where the real .git directory is.
For a submodule, .git is a file containing gitdir: ./relative/path/to/real/.git/modules/path/to/submodule
Which is itself a standard .git directory.
Unfortunately if I attempt to reference it it considers the repository bare.
The text was updated successfully, but these errors were encountered:
In my limited testing, simply updating Repository::initDir to also accept $realGitDir . '/.git' as a file and then read the path of the gitdir out of that, and that seems to work but obviously I have not done anything beyond the most basic testing.
if (false === $realGitDir) {
thrownewInvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $gitDir));
} elseif (!is_dir($realGitDir)) {
thrownewInvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $realGitDir));
} elseif (null === $workingDir && is_dir($realGitDir.'/.git')) {
$workingDir = $realGitDir;
$realGitDir = $realGitDir.'/.git';
} elseif (null === $workingDir && file_exists($realGitDir.'/.git')) {
$workingDir = $realGitDir;
$gitFile = trim(file_get_contents($realGitDir . '/.git'));
$parts = explode(':', $gitFile);
if (trim($parts[0] ?? '') !== 'gitdir') {
thrownewInvalidArgumentException(sprintf('Directory "%s" has a .git file but is not a valid reference to a git directory', $realGitDir));
}
$realGitDir = realpath($realGitDir . DIRECTORY_SEPARATOR . trim($parts[1] ?? ''));
}
I'm trying to open a repository that is a submodule and it is failing as it expects .git to be a directory, not a reference to where the real .git directory is.
For a submodule, .git is a file containing
gitdir: ./relative/path/to/real/.git/modules/path/to/submodule
Which is itself a standard .git directory.
Unfortunately if I attempt to reference it it considers the repository bare.
The text was updated successfully, but these errors were encountered: