Follow-up from "Prefetch pathLastCommit GraphQL with StartupJS"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Close this issue

The following discussion from !51429 (merged) should be addressed:

  • discussion: (+3 comments)

I'm a little bit hesitant about the combination:

current_route_path = request.fullpath.match(/-\/tree\/[^\/]+\/(.+$)/).to_a[1]
path: current_route_path || ""

I have two comments on that:

  1. I see in the GraphQL query annotation that the path is not required:

    query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {

    Maybe we can get away without the || "" guard since it is allowed to be nil?

  2. Is there any way to test this logic? When I see regexp that I can't immediately understand, I usually look for unit tests to see what input/output am I working with.

Edited Sep 22, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading