From b80ce5103d0eb2bbeb1fa8ad98e546fc8c9e5d91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 13 Jul 2023 16:39:06 -0400
Subject: [PATCH] conversationrepository: avoid recursive merge

There is no need as we always merge two branches so we can avoid
a lot of recursive operations. Moreover, this seems to cause some
weird locks

To be honest I'm not sure about the usage of this argument, doc is
still a bit unclear:

    Maximum number of times to merge common ancestors to build a
    virtual merge base when faced with criss-cross merges.
    When this limit is reached, the next ancestor will simply be used
    instead of attempting to merge it. The default is unlimited.

GitLab: #871
Change-Id: I9c22208626e7f6ff489e91b72a580238a6137499
---
 src/jamidht/conversationrepository.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp
index b67b06f702..6fb1c1a569 100644
--- a/src/jamidht/conversationrepository.cpp
+++ b/src/jamidht/conversationrepository.cpp
@@ -3230,6 +3230,7 @@ ConversationRepository::merge(const std::string& merge_id, bool force)
 
     git_merge_options merge_opts;
     git_merge_options_init(&merge_opts, GIT_MERGE_OPTIONS_VERSION);
+    merge_opts.recursion_limit = 2;
     git_index* index_ptr = nullptr;
     if (git_merge_commits(&index_ptr, repo.get(), head_commit.get(), other_commit.get(), &merge_opts)
         < 0) {
-- 
GitLab