API calls to determine if one branch can be fast-forward merged into another

I am writing a customized web dashboard for Gitlab.

Given branches A and B, I would like to provide an indication of whether branch A can be fast-forward merged into branch B.

It can NOT be assumed that an MR already exists for A->B. The question is really about branches for a potential MR.

Nominally, you could view this as a “git API” question because it’s a question about the state of the git branches and not so much about GitLab. And theoretically the “question” can be poised to git a number of ways:

  1. Is the HEAD commit of A a descendant of B`
  2. It be asked about the branches rather than the commits
  3. It could be asked about a merge attempt.

But in order for a web client to produce this kind of functionality, it’s not pragmatic, to clone the repository and resolve the question via git’s API. Especially given that I really want the vast majority of this web client to operate as a browser client rather than a server.

Is there a way to do this via the GitLab APIs.

Actually I’m trying to make it generic (not specific to my enterprise) and hopefully will open source it.

I have some particular goals:

  1. The web client and the backing server have/retain no knowledge at all about the particular GitLab instance.
  2. The set of things that are displayed on the dashboard are configured by Spring Boot application properties rather than written in code.
  3. KEY ITEM: The Dashboard understands not only “GitLab stuff” but also interprets the CONTENT of repositories. For example… (next item).
  4. … via “plugins” to the dashboard, it can be made to understand common frameworks. For example, for Maven the dashboard might display the artifact id and version in a pom.xml file. For NPM projects it might do the same via the package.json. For Spring Boot projects, it might be able to report specification application.properties that are specified in the Dashboards configuration.

Question: Does anyone KNOW of an existing open-source or commercial effort similar in nature?

I am somewhat familiar with the builtin Dashboard, and the builtin “Dependencies” feature, but these seem not as general as what I’m doing although I’m not familiar with them in depth