Skip to content

Commit 595f102

Browse files
BarabanovVVlv.barabanov
andauthored
Bad idea to merge two branches without history (#82)
Co-authored-by: v.barabanov <v.barabanov@Brbnkn-MBPro-4.local>
1 parent bc66a68 commit 595f102

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Sources/AnalyticsGen/Providers/Forgejo/ForgejoRemoteRepoProvider.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ struct ForgejoRemoteRepoProvider: RemoteRepoProvider {
3939
Log.debug("Cloning repository...")
4040
switch ref {
4141
case .tag(let name), .branch(let name):
42-
try shell("git clone --depth 1 -b \(name) \(gitRepositoryURL) \(repositoryPath)")
43-
4442
if ProcessInfo.processInfo.environment["ANALYTICS_GEN_EXPERIMENTAL_MERGE"] == "true" &&
4543
ProcessInfo.processInfo.environment["CHANGE_TARGET"] == "develop"
4644
{
4745
Log.debug("Trying to merge master into user branch")
46+
try shell("git clone -b \(name) \(gitRepositoryURL) \(repositoryPath)")
4847
try shell("cd \(repositoryPath) && git fetch --depth 1 origin refs/heads/master:refs/remotes/origin/master")
49-
try shell("cd \(repositoryPath) && git merge origin/master --allow-unrelated-histories --no-edit")
48+
try shell("cd \(repositoryPath) && git merge origin/master --no-edit")
49+
} else {
50+
try shell("git clone --depth 1 -b \(name) \(gitRepositoryURL) \(repositoryPath)")
5051
}
5152
case .commit(let sha):
5253
try shell("git clone \(gitRepositoryURL) \(repositoryPath)")

0 commit comments

Comments
 (0)