1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Repository routes missing from the `gitlab` crate:
//! `GET /projects/:id/repository/merge_base`.
use Cow;
use NameOrId;
use ;
/// Find the common ancestor of two or more refs (branch names, tags or SHAs).
///
/// Maps to `GET /projects/:id/repository/merge_base?refs[]=a&refs[]=b`.
/// The answer is the merge base commit (`id`, `short_id`, ...). Comparing it
/// with one of the refs tells whether that ref is an ancestor of the others.
///
/// # Examples
///
/// ```no_run
/// use ironflow_ops_gitlab::GitLab;
/// use ironflow_ops_gitlab::endpoints::repository::MergeBase;
/// use gitlab::api::common::NameOrId;
///
/// # async fn example() -> Result<(), ironflow_core::error::OperationError> {
/// let gitlab = GitLab::new("glpat-xxxx", "gitlab.com").await?;
/// let endpoint = MergeBase {
/// project: NameOrId::from("group/project"),
/// refs: vec!["0a1b2c3".to_string(), "main".to_string()],
/// };
/// let op = gitlab.op(endpoint);
/// # Ok(())
/// # }
/// ```
///
/// # Errors
///
/// Returns an error if the request fails, for instance when the refs share no
/// history (GitLab answers 400) or a ref does not exist.