Skip to content

fix(extensions): only strip a trailing .git suffix - #29652

Open
artemkulyk wants to merge 1 commit into
google-gemini:mainfrom
artemkulyk:fix/git-suffix-only-trailing
Open

artemkulyk wants to merge 1 commit into
google-gemini:mainfrom
artemkulyk:fix/git-suffix-only-trailing

Conversation

@artemkulyk

Copy link
Copy Markdown

Summary

tryParseGithubUrl stripped .git with String.replace('.git', ''), which
removes the first occurrence anywhere in the name rather than the suffix. Any
repo whose name merely contains .git gets mangled: blog.github.io parses to
hub.io, so install/update then calls
/repos/owner/hub.io/releases/latest and 404s. getExtensionId() also derives
its id from that corrupted name, so the extension identity stays wrong even
after a manual fix.

Details

Only strip a trailing .git, matching the expected fix in the issue. Nothing
changes for normal clone URLs (owner/repo.git still parses to owner/repo).

Related Issues

Fixes #29037

How to Validate

tryParseGithubUrl('https://github.com/owner/repo.git')       // owner / repo
tryParseGithubUrl('https://github.com/owner/blog.github.io') // owner / blog.github.io (was hub.io)
tryParseGithubUrl('owner/my.git.repo')                       // owner / my.git.repo   (was repo)

npx vitest run src/config/extensions/github.test.ts in packages/cli passes
(36 tests).

I also asked on the issue about help wanted, since that is what the
contribution policy keys off. Happy to leave this parked until a maintainer
weighs in.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

@artemkulyk
artemkulyk requested a review from a team as a code owner October 6, 2026 18:08
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where repository names containing the substring '.git' were being incorrectly truncated during URL parsing. By updating the logic to specifically target the trailing suffix, the parser now correctly handles edge cases such as GitHub Pages repository names, ensuring the repository identity remains intact.

Highlights

  • Bug fix in URL parsing: Replaced the global string replacement of '.git' with a regex-based approach that only targets the trailing '.git' suffix.
  • Improved test coverage: Added new test cases to verify that repository names containing '.git' are parsed correctly without being mangled.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@github-actions github-actions Bot added the size/xs An extra small PR label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

📊 PR Size: size/XS

  • Lines changed: 4
  • Additions: +3
  • Deletions: -1
  • Files changed: 2

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a bug in the GitHub URL parser where any occurrence of ".git" in the repository name (such as in "blog.github.io") was incorrectly removed. The implementation has been corrected to only strip ".git" when it appears at the end of the repository name using a regular expression. Additionally, new test cases have been added to verify this behavior. No review comments were provided, and the changes look solid.

@gemini-cli gemini-cli Bot added the area/extensions Issues related to Gemini CLI extensions capability label Oct 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/extensions Issues related to Gemini CLI extensions capability size/xs An extra small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: GitHub repo parsing strips '.git' anywhere in the name (blog.github.io -> hub.io)

1 participant