fix: support hashtag and special chars in branch names for git clone#4644
Open
Siumauricio wants to merge 1 commit into
Open
fix: support hashtag and special chars in branch names for git clone#4644Siumauricio wants to merge 1 commit into
Siumauricio wants to merge 1 commit into
Conversation
Branch names were interpolated unquoted into the git clone shell command, so a `#` (valid in git branch names) started a shell comment and dropped the rest of the command, causing the clone to fail (#4585). Escape the branch name with shell-quote (already a dependency) across all providers: gitlab, github, gitea, bitbucket and custom git.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Escape the branch name when building the
git cloneshell command across all git providers (gitlab, github, gitea, bitbucket, custom git).Why
Fixes #4585. Branch names were interpolated unquoted into the shell command:
In shell,
#starts a comment — and#is a valid character in git branch names. So a branch likefeature#123becamegit clone --branch feature, dropping the rest of the command (repo URL, output path), and the clone failed.How
Wrap the branch with
quote()fromshell-quote, which is already a dependency ofpackages/serverand already used in the docker/compose/railpack builders. This properly handles#and any other shell metacharacters consistently with the rest of the codebase.Applied to:
packages/server/src/utils/providers/gitlab.ts(the one in the issue)packages/server/src/utils/providers/github.tspackages/server/src/utils/providers/gitea.tspackages/server/src/utils/providers/bitbucket.tspackages/server/src/utils/providers/git.ts