Drone

Clone step: refusing to merge unrelated histories

When pushing a commit to a branch that is associated with a pull request, during the clone step, git merge errors with fatal: refusing to merge unrelated histories. Has anyone else experienced this?

Initialized empty Git repository in /drone/src/.git/
2 + git fetch --depth=1 origin +refs/heads/master:
3
4 From https://github.com/me/myrepo
5 * branch master -> FETCH_HEAD
6 * [new branch] master -> origin/master
7
8 + git checkout master
9 Branch 'master' set up to track remote branch 'master' from 'origin'.
10 Already on 'master'
11
12 + git fetch origin refs/pull/124/head:
13 From https://github.com/me/myrepo
14 * branch refs/pull/124/head -> FETCH_HEAD
15
16 + git merge f2f2d84437a108796ae0bf5d1d8da678d0d27ee6
17 fatal: refusing to merge unrelated histories

The solution to this, by @leoxiongideahq:

We’ve fixed it by removing the clone depth limit. It was previously set to 1 for a shallow clone.

Tried it and worked for me too.