From 12976550d35bad8d535518010046bd136875736b Mon Sep 17 00:00:00 2001 From: hacki Date: Fri, 29 Nov 2024 08:55:43 +0100 Subject: [PATCH] fix(remote): fix detection of GitLab merge request sha (#968) --- git-cliff-core/src/remote/gitlab.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/git-cliff-core/src/remote/gitlab.rs b/git-cliff-core/src/remote/gitlab.rs index 1e2387058d..dba8d87f77 100644 --- a/git-cliff-core/src/remote/gitlab.rs +++ b/git-cliff-core/src/remote/gitlab.rs @@ -170,7 +170,7 @@ impl RemotePullRequest for GitLabMergeRequest { } fn merge_commit(&self) -> Option { - self.merge_commit_sha.clone() + self.merge_commit_sha.clone().or(Some(self.sha.clone())) } } @@ -310,4 +310,13 @@ mod test { assert_eq!(Some(1626610479), remote_commit.timestamp()); } + + #[test] + fn merge_request_no_merge_commit() { + let mr = GitLabMergeRequest { + sha: String::from("1d244937ee6ceb8e0314a4a201ba93a7a61f2071"), + ..Default::default() + }; + assert!(mr.merge_commit().is_some()); + } }