Skip to content

Enable symlink support explicitly #3406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Sources/SourceControl/GitRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public struct GitRepositoryProvider: RepositoryProvider {
precondition(!localFileSystem.exists(path))

// FIXME: Ideally we should pass `--progress` here and report status regularly. We currently don't have callbacks for that.
try self.callGit("clone", "--mirror", repository.url, path.pathString,
//
// NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
try self.callGit("clone", "-c", "core.symlinks=true", "--mirror", repository.url, path.pathString,
repository: repository,
failureMessage: "Failed to clone repository \(repository.url)")
}
Expand Down Expand Up @@ -118,7 +120,9 @@ public struct GitRepositoryProvider: RepositoryProvider {
// For editable clones, i.e. the user is expected to directly work on them, first we create
// a clone from our cache of repositories and then we replace the remote to the one originally
// present in the bare repository.
try self.callGit("clone", "--no-checkout", sourcePath.pathString, destinationPath.pathString,
//
// NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
try self.callGit("clone", "-c", "core.symlinks=true", "--no-checkout", sourcePath.pathString, destinationPath.pathString,
repository: repository,
failureMessage: "Failed to clone repository \(repository.url)")
// The default name of the remote.
Expand All @@ -138,7 +142,9 @@ public struct GitRepositoryProvider: RepositoryProvider {
// re-resolve such that the objects in this repository changed, we would
// only ever expect to get back a revision that remains present in the
// object storage.
try self.callGit("clone", "--shared", "--no-checkout", sourcePath.pathString, destinationPath.pathString,
//
// NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
try self.callGit("clone", "-c", "core.symlinks=true", "--shared", "--no-checkout", sourcePath.pathString, destinationPath.pathString,
repository: repository,
failureMessage: "Failed to clone repository \(repository.url)")
}
Expand Down