Add GraphQL blame endpoint
This MR was previously approved but merged incorrectly: !128103 (merged)
What does this MR do and why?
Add a Graphql blame end point.
Expose git blame data via a GraphQL endpoint.
Relies on !128101 (merged) to get blame span value as per this discussion.
That MR needs to be merged first
Contributes to #393764 (closed)
Feature flag: #419808 (closed)
How to set up and validate locally
-
Make sure to enable the feature flag
graphql_git_blame
-Feature.enable(:graphql_git_blame)
-
Create as root create a project called blame-test. Add a file 'test file' and add some text across multiple lines.
-
Perform the following query against either the API; http://127.0.0.1:3000/api/graphql, or the GrapiQL UI; http://127.0.0.1:3000/-/graphql-explorer:
query TestQuery($fullPath: ID!) { project(fullPath: $fullPath) { repository { blobs(paths: ["test file"]) { nodes { blame(fromLine: 2, toLine: 6 ){ firstLine groups { lineno lines span commit { sha } commitData { authorAvatar ageMapClass commitLink commitAuthorLink projectBlameLink timeAgoTooltip } } } } } } } }
With query Variables:
{ "fullPath": "root/blame-test" }
-
You should see the following returned:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #393764 (closed)