snowflake-cli icon indicating copy to clipboard operation
snowflake-cli copied to clipboard

SNOW-2679889: git execute command doesn't support "/" in branch name

Open MaxHoecker opened this issue 2 months ago • 0 comments

SnowCLI version

3.10.0

Python version

3.13.1

Platform

Windows-11-10.0.26100-SP0

What happened

When trying to run git execute, if the git repo name has to be wrapped in quotes (common as github repos often have hyphens in the name) and you have a branch with a slash in it, the command fails.

If you only need quotes around either the repo name or the branch name, it works fine

Successful: repo name: "example" branch name: "feature/branch" command: snow git execute @"example/branches/\"feature/branch\"/*"

Successful: repo name: "example-repo" branch name: "feature" command: snow git execute @"\"example-repo\"/branches/feature/*"

Incorrectly Fails: repo name: "example" branch name: "feature/branch" command: snow git execute @"\"example-repo\"/branches/\"feature/branch\"/*" error message: Invalid string @"example-repo"/branches/"feature/branch"/*, too much " in path, expected 2.

The CLI needs to support both quotes around the repo name and branch name as both can contain special characters.

This is the exact if condition the error is coming from that should support up to 4 " characters instead of up to 2 https://github.com/snowflakedb/snowflake-cli/blob/main/src/snowflake/cli/_plugins/git/manager.py#L119-L122

Console output

Invalid string @"example-repo"/branches/"feature/branch"/*, too much " in path, expected 2.

How to reproduce

create git repo object with special characters i.e. "example-repo" create branch in repo with "/" in the name i.e. "feature/branch" run any of the following ways a user would expect to specify a repo and branch to execute against snow git execute @"\"example-repo\"/branches/\"feature/branch\"/*" snow git execute @"\"example-repo\"/branches/feature/branch/*" snow git execute @"\"example-repo/branches/feature/branch\"/*"

MaxHoecker avatar Nov 05 '25 22:11 MaxHoecker