@@ -82,9 +82,18 @@ public struct GitRepositoryProvider: RepositoryProvider {
82
82
// shallow clone.
83
83
precondition ( !localFileSystem. exists ( path) )
84
84
// FIXME: Ideally we should pass `--progress` here and report status regularly. We currently don't have callbacks for that.
85
+ //
86
+ // NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
87
+ // FIXME: Remove the judgement before a cross-platform release
88
+ #if os(Windows)
89
+ try self . callGit ( " clone " , " -c " , " core.symlinks=true " , " --mirror " , repository. url, path. pathString,
90
+ repository: repository,
91
+ failureMessage: " Failed to clone repository \( repository. url) " )
92
+ #else
85
93
try self . callGit ( " clone " , " --mirror " , repository. url, path. pathString,
86
94
repository: repository,
87
95
failureMessage: " Failed to clone repository \( repository. url) " )
96
+ #endif
88
97
}
89
98
90
99
public func copy( from sourcePath: AbsolutePath , to destinationPath: AbsolutePath ) throws {
@@ -105,9 +114,18 @@ public struct GitRepositoryProvider: RepositoryProvider {
105
114
// For editable clones, i.e. the user is expected to directly work on them, first we create
106
115
// a clone from our cache of repositories and then we replace the remote to the one originally
107
116
// present in the bare repository.
117
+ //
118
+ // NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
119
+ // FIXME: Remove the judgement before a cross-platform release
120
+ #if os(Windows)
121
+ try self . callGit ( " clone " , " -c " , " core.symlinks=true " , " --no-checkout " , sourcePath. pathString, destinationPath. pathString,
122
+ repository: repository,
123
+ failureMessage: " Failed to clone repository \( repository. url) " )
124
+ #else
108
125
try self . callGit ( " clone " , " --no-checkout " , sourcePath. pathString, destinationPath. pathString,
109
126
repository: repository,
110
127
failureMessage: " Failed to clone repository \( repository. url) " )
128
+ #endif
111
129
// The default name of the remote.
112
130
let origin = " origin "
113
131
// In destination repo remove the remote which will be pointing to the source repo.
@@ -125,9 +143,18 @@ public struct GitRepositoryProvider: RepositoryProvider {
125
143
// re-resolve such that the objects in this repository changed, we would
126
144
// only ever expect to get back a revision that remains present in the
127
145
// object storage.
146
+ //
147
+ // NOTE: Explicitly set `core.symlinks=true` on `git clone` to ensure that symbolic links are correctly resolved.
148
+ // FIXME: Remove the judgement before a cross-platform release
149
+ #if os(Windows)
150
+ try self . callGit ( " clone " , " -c " , " core.symlinks=true " , " --shared " , " --no-checkout " , sourcePath. pathString, destinationPath. pathString,
151
+ repository: repository,
152
+ failureMessage: " Failed to clone repository \( repository. url) " )
153
+ #else
128
154
try self . callGit ( " clone " , " --shared " , " --no-checkout " , sourcePath. pathString, destinationPath. pathString,
129
155
repository: repository,
130
156
failureMessage: " Failed to clone repository \( repository. url) " )
157
+ #endif
131
158
}
132
159
}
133
160
0 commit comments