Skip to content

Commit 83ace6d

Browse files
authored
Merge pull request #696 from aciidb0mb3r/clone-checko
[GitRepository] Use remote from checkout manager
2 parents a477ba3 + 03df9cd commit 83ace6d

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Sources/SourceControl/GitRepository.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,11 @@ public class GitRepositoryProvider: RepositoryProvider {
8383
Git.tool, "clone", sourcePath.asString, destinationPath.asString, message: nil)
8484
// The default name of the remote.
8585
let origin = "origin"
86-
// Get the remote from original repo.
87-
let source = GitRepository(path: sourcePath, isWorkingRepo: false)
88-
guard let remote = try source.remotes().first(where: {$0.name == origin}) else {
89-
fatalError("Expected \(repository) to have an origin")
90-
}
9186
// In destination repo remove the remote which will be pointing to the source repo.
9287
let clone = GitRepository(path: destinationPath)
9388
try clone.remove(remote: origin)
9489
// Add the original remote to the new clone.
95-
try clone.add(remote: remote.name, url: remote.url)
90+
try clone.add(remote: origin, url: repository.url)
9691
// FIXME: This is unfortunate that we have to fetch to update remote's data.
9792
try clone.fetch()
9893
} else {

0 commit comments

Comments
 (0)