Skip to content

Commit ff312c1

Browse files
v.barabanovv.barabanov
authored andcommitted
Bad idea to merge two branches without history
1 parent e584900 commit ff312c1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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)