fix(glrepo): handle api_host subdirectory when git SSH host differs

Description

When api_host contains a subdirectory (e.g., "gitlab.example.com/gitlab") but the git remote uses a different SSH host (e.g., "git.example.com"), the git URL path won't contain the subdirectory. The previous code incorrectly attempted to strip a non-existent subdirectory.

This fix uses strings.TrimPrefix which safely handles both cases:

  • Path contains subdirectory: strips it
  • Path doesn't contain subdirectory: returns path unchanged

Resolves #8146

How has this been tested?

Adds test case for separate git SSH host with api_host subdirectory.

Also tested via daily use with our hosted gitlab setup that follows this pattern.

Merge request reports

Loading