diff --git a/src/jamidht/conversation.cpp b/src/jamidht/conversation.cpp index 99912169c08bf398f02c934ef51b7811890005a5..4c97845ffe06b109adb9eeff431ab0b2f97a3fb9 100644 --- a/src/jamidht/conversation.cpp +++ b/src/jamidht/conversation.cpp @@ -1033,6 +1033,7 @@ Conversation::lastCommitId() const { LogOptions options; options.nbOfCommits = 1; + options.skipMerge = true; auto messages = pimpl_->loadMessages(options); if (messages.empty()) return {}; diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp index 6b806c723243ad2074ab4b5a583f74c12e0513a0..7944c82e4767ff78fbe7fa8986a9711442f7fe28 100644 --- a/src/jamidht/conversationrepository.cpp +++ b/src/jamidht/conversationrepository.cpp @@ -2052,11 +2052,14 @@ ConversationRepository::Impl::log(const LogOptions& options) const auto startLogging = options.from == ""; auto breakLogging = false; forEachCommit( - [&](const auto& id, const auto& author, const auto&) { + [&](const auto& id, const auto& author, const auto& commit) { if (!commits.empty()) { // Set linearized parent commits.rbegin()->linearized_parent = id; } + if (options.skipMerge && git_commit_parentcount(commit.get()) > 1) { + return CallbackResult::Skip; + } if ((options.nbOfCommits != 0 && commits.size() == options.nbOfCommits)) return CallbackResult::Break; // Stop logging diff --git a/src/jamidht/conversationrepository.h b/src/jamidht/conversationrepository.h index 64fc5ff6fe21b7f0dd555e6b5b678bf75ba71d10..936d9c322e6c441cc9b384f93f0f7648ef052231 100644 --- a/src/jamidht/conversationrepository.h +++ b/src/jamidht/conversationrepository.h @@ -60,7 +60,7 @@ struct LogOptions std::string from {}; std::string to {}; uint64_t nbOfCommits {0}; // maximum number of commits wanted - + bool skipMerge {false}; // Do not include merge commits in the log. Used by the module to get last interaction without potential merges bool includeTo {false}; // If we want or not the "to" commit [from-to] or [from-to) bool fastLog {false}; // Do not parse content, used mostly to count bool logIfNotFound {true}; // Add a warning in the log if commit is not found