scala-steward
scala-steward copied to clipboard
Merge in repo with submodules fails
Merging the base branch into an update branch when there is a merge conflict and the repos is using submodules can fail with an error like this:
java.io.IOException: 'git merge --strategy-option=theirs --gpg-sign master' exited with code 1
warning: Failed to merge submodule modules/tests/metadata (commits don't follow merge-base)
It is unclear to me what we need to do with the submodules so that git merge --strategy-option=theirs always succeeds.
Here is the complete log of a repo where this happens:
2019-12-12 16:10:08,201 INFO ──────────── Nurture coursier/coursier ────────────
2019-12-12 16:10:08,201 INFO Clone and synchronize coursier/coursier
2019-12-12 16:10:24,223 INFO Find updates for coursier/coursier
2019-12-12 16:11:46,515 INFO Ignore org.scala-lang:scala-library : 2.12.10 -> 2.13.0 -> 2.13.1 (reason: ignored globally)
2019-12-12 16:11:46,515 INFO Ignore org.scala-lang:scala-library:provided : 2.12.10 -> 2.13.0 -> 2.13.1 (reason: ignored globally)
2019-12-12 16:11:46,515 INFO Ignore org.scala-lang:scala-reflect:provided : 2.12.10 -> 2.13.0 -> 2.13.1 (reason: ignored globally)
2019-12-12 16:11:46,516 INFO Found 4 updates:
ch.epfl.scala:sbt-scalajs-bundler : 0.14.0 -> 0.16.0
com.squareup.okhttp3:{okhttp, okhttp-urlconnection} : 3.13.1 -> 3.14.4
org.typelevel:cats-core : 1.6.0 -> 2.0.0
org.scalatest:scalatest:test : 3.0.8 -> 3.1.0
2019-12-12 16:11:46,524 INFO Process update ch.epfl.scala:sbt-scalajs-bundler : 0.14.0 -> 0.16.0
2019-12-12 16:11:46,954 INFO Found PR https://github.com/coursier/coursier/pull/1458
2019-12-12 16:11:47,761 INFO PR has no conflict with master
2019-12-12 16:11:48,348 INFO Process update com.squareup.okhttp3:{okhttp, okhttp-urlconnection} : 3.13.1 -> 3.14.4
2019-12-12 16:11:48,719 INFO Found PR https://github.com/coursier/coursier/pull/1388
2019-12-12 16:11:49,440 INFO PR has no conflict with master
2019-12-12 16:11:50,095 INFO Process update org.typelevel:cats-core : 1.6.0 -> 2.0.0
2019-12-12 16:11:50,791 INFO Found PR https://github.com/coursier/coursier/pull/1361
2019-12-12 16:11:51,514 INFO PR has conflicts with master
2019-12-12 16:11:51,514 INFO Merge branch 'master' into update/cats-core-2.0.0 and apply again
java.io.IOException: 'git checkout master' exited with code 1
error: you need to resolve your current index first
modules/tests/metadata: needs merge
at org.scalasteward.core.io.process$.$anonfun$slurp$9(process.scala:48)
at org.scalasteward.core.io.process$.$anonfun$slurp$9$adapted(process.scala:44)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:139)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:136)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:136)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
at cats.effect.internals.PoolUtils$$anon$2$$anon$3.run(PoolUtils.scala:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-12-12 16:11:52,247 ERROR ──────────── Nurture coursier/coursier ──────────── failed
java.io.IOException: 'git merge --strategy-option=theirs --gpg-sign master' exited with code 1
warning: Failed to merge submodule modules/tests/metadata (commits don't follow merge-base)
Removing project/project/plugins.sbt
Auto-merging project/Deps.scala
Auto-merging modules/tests/shared/src/test/resources/resolutions/software.amazon.awssdk/utils/2.5.17_dep89fcd1e0d8d1109e23bfe9d2d3afa95dd6901f0b
Auto-merging modules/tests/shared/src/test/resources/resolutions/sh.almond/scala-kernel_2.12.7/0.2.2_paramsa3b0313a2f2d39692416c25848f2f16908d6d7f0
Auto-merging modules/tests/shared/src/test/resources/resolutions/sh.almond/scala-kernel_2.12.7/0.2.2_params2f53eeb0a22d24b1e7106dd9a06902e9cd19570f
Auto-merging modules/tests/shared/src/test/resources/resolutions/sh.almond/scala-kernel_2.12.7/0.2.2_params1a55983296bd4c89705468d940bbb9180e08ed62
Auto-merging modules/tests/shared/src/test/resources/resolutions/org.webjars.npm/randomatic/1.1.7_dep9919d01ecf0a4e7a3a7394c3f5ed27ee8a8b972d
Auto-merging modules/tests/shared/src/test/resources/resolutions/org.json4s/json4s-native_2.12/[3.3.0,3.5.0)_dep84b99af54bdc00a806d05706aa6736a7c05a84c1
Removing modules/tests/shared/src/test/resources/resolutions/org.apache.spark/spark-core_2.11/1.3.1.jcabi
Removing modules/tests/shared/src/test/resources/resolutions/io.netty/netty-transport-native-epoll/4.1.34.Final_paramsf8142203c268ee0f8c1ed1160ee19d0eb30002f1
Auto-merging modules/tests/shared/src/test/resources/resolutions/io.netty/netty-transport-native-epoll/4.1.34.Final_paramsf7d444e01ea72b5aa3a0131f7becc6a78ec2ce0c
Removing modules/tests/shared/src/test/resources/resolutions/io.netty/netty-transport-native-epoll/4.1.34.Final_paramsb466ab3086b0bf8076755897d323966bb3d81624
Auto-merging modules/tests/shared/src/test/resources/resolutions/io.netty/netty-transport-native-epoll/4.1.34.Final_params44391b6d0f811c73f3c5c682c267a2c1b913175c
Auto-merging modules/tests/shared/src/test/resources/resolutions/io.netty/netty-transport-native-epoll/4.1.34.Final_params2f28e77b04ca22440e089f82d2e657da049be712
Auto-merging modules/tests/shared/src/test/resources/resolutions/com.lihaoyi/ammonite_2.12.8/1.6.3_paramsf4686ce20ae15ea33b098509d92ec7920b994383
Auto-merging modules/tests/shared/src/test/resources/resolutions/com.lihaoyi/ammonite_2.11.8/1.6.3_paramsa01be340ff9f190fdb6de1076f9bc9d30297dcce
Removing modules/tests/shared/src/test/resources/resolutions/com.github.alexarchambault/argonaut-shapeless_6.2_2.12/1.2.0-M4_depc7dd6de1636ac652de44565a82e3cbe2511cba3_paramsbe22841b0ce3cc4cb9c752cb88c936e8a35d5ad4
Auto-merging modules/tests/shared/src/test/resources/resolutions/com.github.alexarchambault/argonaut-shapeless_6.2_2.12/1.2.0-M4_dep10b004bba23ba44f77a20a62a1eaf3d6e24490d8_params1cf2315e648711a56a523b76e517fc380dee53fa
Auto-merging modules/tests/shared/src/test/resources/resolutions/com.github.alexarchambault/argonaut-shapeless_6.2_2.12/1.2.0-M11_dep38e67c7b14c665cb297660b26a59bc977bfa458
Auto-merging modules/tests/shared/src/test/resources/resolutions/com.github.alexarchambault/argonaut-shapeless_6.2_2.11/1.2.0-M11_dep912ecd12289f445a785c63b9c6a7684b7a0170fb_paramsf59b950c0c661129fff44bfa4db5052893a4eb0a
Removing modules/tests/shared/src/test/resources/resolutions/com.github.alexarchambault/argonaut-shapeless_6.1_2.11/0.2.0.jcabi
Removing modules/tests/shared/src/test/resources/resolutions/com.chuusai/shapeless_2.12/latest.release_dep79ceebddf6011382a5b71cfd8a2ef2808689f4b6
Auto-merging modules/tests/metadata
CONFLICT (submodule): Merge conflict in modules/tests/metadata
Auto-merging modules/tests/jvm/src/test/scala/coursier/test/IvyLocalTests.scala
Removing modules/coursier/shared/src/main/scala/coursier/params/ResolutionParamsHelpers.scala
Removing modules/coursier/jvm/src/main/scala/coursier/params/CacheParamsHelpers.scala
Removing modules/cli/src/main/contraband/jvm-params.json
Removing modules/cli/src/main/contraband-scala/coursier/params/CacheParams.scala
Automatic merge failed; fix conflicts and then commit the result.
at org.scalasteward.core.io.process$.$anonfun$slurp$9(process.scala:48)
at org.scalasteward.core.io.process$.$anonfun$slurp$9$adapted(process.scala:44)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:139)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:136)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:136)
at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:355)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:376)
at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:316)
at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
at cats.effect.internals.PoolUtils$$anon$2$$anon$3.run(PoolUtils.scala:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-12-12 16:11:52,247 INFO ──────────── Total time: coursier/coursier: 1m 44s 46ms ────────────
BTW, this issue can be reproduced by cloning https://github.com/scala-steward/coursier and trying to merge master into update/cats-core-2.0.0.
This is not an issue for me anymore. Closing.