[Bug]: Mobile pull reports a false merge conflict on a fast-forward (isomorphic-git findMergeBase bug, fixed in 1.42.0)

Author: azukihoneyCreated Sep 26, 2026Updated Sep 26, 2026

Describe the bug

On mobile, Pull reports a merge conflict (and creates conflict-files-obsidian-git.md) even though the remote branch is a strict descendant of the local branch, i.e. the pull should be a plain fast-forward and the local branch has no uncommitted changes.

The cause is in isomorphic-git 1.40.0, which this plugin pins: findMergeBase returns the wrong merge base for some DAG histories (isomorphic-git/isomorphic-git#2109, fixed by isomorphic-git/isomorphic-git#2412 and released in 1.42.0). Because the merge base is wrong, git.merge does not detect the fast-forward and falls back to a three-way merge that conflicts.

It happens when the local commit is reachable from the remote tip only through the second parent of a merge commit, two or more commits deep. For example, a desktop device (real git) merges the history that a mobile device pushed, and the mobile device then pulls that merge:

bash
M        <- origin/main (merge commit pushed from desktop)
| \
X  P2
|  P1
|  C     <- mobile's local main
| /
E

findMergeBase(C, M) should be C, but isomorphic-git 1.40.0 / 1.41.0 returns E.

Side effect: after the failed pull, the index keeps the conflict stages for the file. The working tree file is untouched, but the file keeps showing as changed until the index is reset.

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

I did not capture the console on the phone. The visible result was the conflict notice file listing one note, with the local branch unchanged and the remote-tracking ref already at the new commit.

Steps to reproduce

Minimal script with plain isomorphic-git (Node), independent of Obsidian:

javascript
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import git from "isomorphic-git";

const dir = fs.mkdtempSync(path.join(os.tmpdir(), "iso-mb-"));
const repo = { fs, dir };
const author = { name: "t", email: "[email protected]" };
const commit = async (file, text, message) => {
  fs.writeFileSync(path.join(dir, file), text);
  await git.add({ ...repo, filepath: file });
  return git.commit({ ...repo, message, author });
};

await git.init({ ...repo, defaultBranch: "main" });
const E = await commit("note.md", "v1\n", "E");
await git.branch({ ...repo, ref: "desktop" });
const C = await commit("note.md", "v2-mobile\n", "C");
await commit("other.md", "x\n", "P1");
const P2 = await commit("other.md", "y\n", "P2");
await git.checkout({ ...repo, ref: "desktop" });
const X = await commit("note.md", "v2-desktop\n", "X");
const M = await git.commit({ ...repo, message: "M", author, parent: [X, P2],
  tree: (await git.readCommit({ ...repo, oid: X })).commit.tree });

await git.writeRef({ ...repo, ref: "refs/heads/main", value: C, force: true });
await git.writeRef({ ...repo, ref: "refs/remotes/origin/main", value: M, force: true });
await git.checkout({ ...repo, ref: "main", force: true });

console.log(await git.findMergeBase({ ...repo, oids: [C, M] }), "expected:", C);
try {
  console.log(await git.merge({ ...repo, ours: "main", theirs: "origin/main", abortOnConflict: false, author }));
} catch (e) {
  console.log(e.code, e.data?.filepaths);
}

Results:

isomorphic-git findMergeBase(C, M) merge
1.40.0 (pinned by the plugin) E MergeConflictError ["note.md"]
1.41.0 E MergeConflictError ["note.md"]
1.42.0 C fast-forward
1.42.2 C fast-forward

I hit the same thing on a real vault: the plugin's pull() calls git.merge exactly like this, and it failed on one phone. A second phone, whose local tip was the direct second parent of the merge, fast-forwarded fine.

Expected Behavior

The pull fast-forwards to the remote commit, as git merge-base --is-ancestor confirms and as desktop git does.

Could the isomorphic-git dependency be bumped to 1.42.0 or later?

Addition context

  • isomorphic-git's own report of the algorithm issue: isomorphic-git/isomorphic-git#2109
  • Fix: isomorphic-git/isomorphic-git#2412
  • package.json on master still pins "isomorphic-git": "1.40.0".

Operating system

Android

Installation Method

None

Plugin version

2.40.0