Add first_parent and order arguments to repository commits

What

Adds first_parent and order arguments to the GraphQL Resolvers::Repositories::CommitsResolver, and adds a new CommitOrder enum with values TOPO and DATE.

The model layer (Repository#list_commits) already supports first_parent and order. This change exposes those options through the GraphQL API.

Why

This is a GraphQL API prerequisite for the list_commits MCP tool, which needs to control first-parent traversal and commit ordering when listing commits.

How to test

Run this in GraphiQL (/-/graphql-explorer) against any project with a repository. Toggle order between TOPO and DATE, and firstParent between true and false, to see the ordering and merge-commit traversal change:

{
  project(fullPath: "gitlab-duo/test") {
    repository {
      commits(ref: "main", first: 5, firstParent: true, order: TOPO) {
        nodes {
          sha
          title
          authorName
          authoredDate
        }
        pageInfo {
          hasNextPage
          endCursor
        }
      }
    }
  }
}

References

Edited by Jessie Young

Merge request reports

Loading
Loading