如何修复java.io.IOException:多个合并基础

时间:2013-04-24 02:05:59

标签: git jgit

当我使用jgit完成git pull时,如下所示:

git.pull().call();

导致异常

Caused by: java.io.IOException: Multiple merge bases for:
  0479d50e9bcb14f197e1f703cb9d20ce402e38be
  e52e86d1977a42c934a939f04d63deb8eaeb38bf found:
  518a66929b4480a5bd25defc5fe643937fc16cfa
  513273d6f0327f41c914c7cd5573adeb7d396d8f
    at org.eclipse.jgit.merge.Merger.getBaseCommit(Merger.java:217)
    at org.eclipse.jgit.merge.Merger.mergeBase(Merger.java:182)
    at org.eclipse.jgit.merge.ThreeWayMerger.mergeBase(ThreeWayMerger.java:121)
    at org.eclipse.jgit.merge.ResolveMerger.mergeImpl(ResolveMerger.java:187)
    at org.eclipse.jgit.merge.Merger.merge(Merger.java:156)
    at org.eclipse.jgit.merge.ThreeWayMerger.merge(ThreeWayMerger.java:108)
    at org.eclipse.jgit.api.MergeCommand.call(MergeCommand.java:208)

我想知道为什么会显示mutiple merge bases

我想知道如何使用Jgit而不是命令行git来修复错误?

1 个答案:

答案 0 :(得分:1)

JGit的当前稳定版本还没有"recursive" merge strategy

但它是在开发版本(master分支)中实现的,将随3.0一起发布,请参阅以下提交和bug 380314

http://git.eclipse.org/c/jgit/jgit.git/commit/?id=ab99b78ca08a6b52e9ae8b49afa04dd16496f2ac http://git.eclipse.org/c/jgit/jgit.git/commit/?id=aa7be667bcca4bdb28b2485e28a05da54c431df7

因此,要么自己构建JGit,要么从Eclipse Maven repository下载快照构建。

如果您使用支持Maven依赖项的构建工具,请使用以下存储库和工件版本:

<dependencies>
    <dependency>
        <groupId>org.eclipse.jgit</groupId>
        <artifactId>org.eclipse.jgit</artifactId>
        <version>3.0.0-SNAPSHOT</version>
    </dependency>
</dependencies>
<repositories>
    <repository>
        <id>eclipse-jgit</id>
        <url>https://repo.eclipse.org/content/groups/jgit/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>