From 61001ed4bbd2cb2305fa46125ba8eeb4fbacb776 Mon Sep 17 00:00:00 2001 From: Kevin Nardi Date: Tue, 9 Jul 2024 00:05:14 -0700 Subject: [PATCH] Switch the default branch to "main" GitHub repositories use "main" by default now, so switch to that as the default for the `.git` and `.gitHub` deployment methods. --- Sources/Publish/API/DeploymentMethod.swift | 8 ++++---- Tests/PublishTests/Tests/DeploymentTests.swift | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/Publish/API/DeploymentMethod.swift b/Sources/Publish/API/DeploymentMethod.swift index 81dedb18..433df29c 100644 --- a/Sources/Publish/API/DeploymentMethod.swift +++ b/Sources/Publish/API/DeploymentMethod.swift @@ -36,8 +36,8 @@ public struct DeploymentMethod { public extension DeploymentMethod { /// Deploy a website to a given remote using Git. /// - parameter remote: The full address of the remote to deploy to. - /// - parameter branch: The branch to push to and pull from (default is master). - static func git(_ remote: String, branch: String = "master") -> Self { + /// - parameter branch: The branch to push to and pull from (default is main). + static func git(_ remote: String, branch: String = "main") -> Self { DeploymentMethod(name: "Git (\(remote))") { context in let folder = try context.createDeploymentFolder(withPrefix: "Git") { folder in if !folder.containsSubfolder(named: ".git") { @@ -93,9 +93,9 @@ public extension DeploymentMethod { /// Deploy a website to a given GitHub repository. /// - parameter repository: The full name of the repository (including its username). - /// - parameter branch: The branch to push to and pull from (default is master). + /// - parameter branch: The branch to push to and pull from (default is main). /// - parameter useSSH: Whether an SSH connection should be used (preferred). - static func gitHub(_ repository: String, branch: String = "master", useSSH: Bool = true) -> Self { + static func gitHub(_ repository: String, branch: String = "main", useSSH: Bool = true) -> Self { let prefix = useSSH ? "git@github.com:" : "https://github.com/" return git("\(prefix)\(repository).git", branch: branch) } diff --git a/Tests/PublishTests/Tests/DeploymentTests.swift b/Tests/PublishTests/Tests/DeploymentTests.swift index 6bc4a056..196605ca 100644 --- a/Tests/PublishTests/Tests/DeploymentTests.swift +++ b/Tests/PublishTests/Tests/DeploymentTests.swift @@ -62,8 +62,8 @@ final class DeploymentTests: PublishTestCase { try shellOut(to: [ "git init", - // Not all git installations init with a master branch. - "git checkout master || git checkout -b master", + // Not all git installations init with a main branch. + "git checkout main || git checkout -b main", "git config --local receive.denyCurrentBranch updateInstead" ], at: remote.path) @@ -91,12 +91,12 @@ final class DeploymentTests: PublishTestCase { try shellOut( to: [ "git init", - // Not all git installations init with a master branch. - "git checkout master || git checkout -b master" + // Not all git installations init with a main branch. + "git checkout main || git checkout -b main" ], at: remote.path ) - + // First generate try publishWebsite(in: repo, using: [ .generateHTML(withTheme: .foundation)