Skip to content

Commit

Permalink
fix(remote): fix detection of GitLab merge request sha (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
hackenbergstefan authored Nov 29, 2024
1 parent c449229 commit 1297655
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion git-cliff-core/src/remote/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl RemotePullRequest for GitLabMergeRequest {
}

fn merge_commit(&self) -> Option<String> {
self.merge_commit_sha.clone()
self.merge_commit_sha.clone().or(Some(self.sha.clone()))
}
}

Expand Down Expand Up @@ -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());
}
}

0 comments on commit 1297655

Please sign in to comment.