7

I have a project with a submodule. When trying to merge a branch (named release) into master, git identified some conflicts and raised the following error:

Fast-forwarding submodule path/to/submodule
Auto-merging path/to/submodule
error: add_cacheinfo failed to refresh for path 'path/to/submodule'; merge aborting.

It completely stopped the merge, as no evidence of it is shown with git status, although I can see some files from the branch release. If I run git merge --abort it also complains with:

fatal: There is no merge to abort (MERGE_HEAD missing).
rjmAmaro
  • 618
  • 8
  • 20
  • A fast-forward operation isn't a merge after all, so even if it hadn't aborted on its own, there would still be no merge to abort for this case. Still, Git should have detected this earlier and not left you with a melange. – torek Jul 24 '20 at 01:36

1 Answers1

7

First I had to reset my branch master with:

git reset --hard origin/master

and delete any files that stayed from the aborted merge (files that came from the release).

After, I updated the submodule to the latest version in both branches, with:

git submodule update --recursive --remote

After that I was able to run the merge without further problems with add_cacheinfo.

rjmAmaro
  • 618
  • 8
  • 20
  • I encourage you to report this bug to the Git mailing list: git@vger.kernel.org, with steps to reproduce if possible. – philb Jul 23 '20 at 19:16
  • I use git `rebase` my develop branch from `master`. The same error happens. I get solved with forcing my develop branch submodule to be the same `commit id` with master branch. – mariolu Feb 24 '22 at 08:02