Environment
- sentry-cli version: 3.3.5 (latest)
- Platform: Linux (GitHub Actions,
actions/checkout)
- Git remote URL:
https://github.com/our-org/our-repo (set by actions/checkout)
Description
When using sentry-cli releases set-commits --local, the repository field in the commits payload is set to the git remote name (e.g. "origin") instead of the parsed repository identifier (e.g. "our-org/our-repo").
This causes the commits to be associated with a stale "origin" repository entry in Sentry (Unknown Provider) instead of the correct GitHub-integrated repository.
Root Cause
In src/commands/releases/set_commits.rs (lines 203-204), the --local flow does:
let remote = config.get_cached_vcs_remote(); // returns "origin" (remote name)
let parsed = get_repo_from_remote(&remote); // passes "origin" to URL parser
get_cached_vcs_remote() returns the remote name (default "origin" from get_default_vcs_remote() in src/config.rs).
get_repo_from_remote() calls VcsUrl::parse() which expects a URL. Since "origin" matches neither GIT_URL_RE nor GIT_SSH_RE, it falls through to the default case:
VcsUrl {
provider: "".into(),
id: url.into(), // "origin" is returned as-is
}
Comparison with --auto flow
The --auto flow correctly handles this. In find_matching_rev() (vcs.rs line 474):
if let Ok(remote) = repo.find_remote(&remote_name.unwrap_or_else(|| "origin".to_owned()));
if let Some(url) = remote.url();
Here, "origin" is used as a remote name to look up the actual URL via git2::Repository::find_remote(), and the URL is then used for matching.
The --local flow skips this URL resolution step.
Expected Fix
In the --local flow, resolve the remote name to its URL before passing to get_repo_from_remote():
let remote_name = config.get_cached_vcs_remote();
let repo = git2::Repository::open_from_env()?;
let remote_url = git_repo_remote_url(&repo, &remote_name)?; // already exists in vcs.rs
let parsed = get_repo_from_remote(&remote_url);
git_repo_remote_url() already exists in src/utils/vcs.rs (line 253) and does exactly this lookup.
Current Workaround
Setting SENTRY_VCS_REMOTE to the full URL instead of relying on the default:
export SENTRY_VCS_REMOTE="$(git remote get-url origin)"
sentry-cli releases set-commits --local "$VERSION" --ignore-missing --initial-depth 20
This works because get_default_vcs_remote() prioritizes the environment variable, and VcsUrl::parse() can correctly parse the full URL.
Impact
--local mode sends "repository": "origin" in the commits payload
- patchSet data is computed correctly but associated with the wrong repository
- Suspect Commits feature does not work because commits are not linked to the GitHub-integrated repository
Environment
actions/checkout)https://github.com/our-org/our-repo(set byactions/checkout)Description
When using
sentry-cli releases set-commits --local, therepositoryfield in the commits payload is set to the git remote name (e.g."origin") instead of the parsed repository identifier (e.g."our-org/our-repo").This causes the commits to be associated with a stale
"origin"repository entry in Sentry (Unknown Provider) instead of the correct GitHub-integrated repository.Root Cause
In
src/commands/releases/set_commits.rs(lines 203-204), the--localflow does:get_cached_vcs_remote()returns the remote name (default"origin"fromget_default_vcs_remote()insrc/config.rs).get_repo_from_remote()callsVcsUrl::parse()which expects a URL. Since"origin"matches neitherGIT_URL_REnorGIT_SSH_RE, it falls through to the default case:Comparison with
--autoflowThe
--autoflow correctly handles this. Infind_matching_rev()(vcs.rs line 474):Here,
"origin"is used as a remote name to look up the actual URL viagit2::Repository::find_remote(), and the URL is then used for matching.The
--localflow skips this URL resolution step.Expected Fix
In the
--localflow, resolve the remote name to its URL before passing toget_repo_from_remote():git_repo_remote_url()already exists insrc/utils/vcs.rs(line 253) and does exactly this lookup.Current Workaround
Setting
SENTRY_VCS_REMOTEto the full URL instead of relying on the default:This works because
get_default_vcs_remote()prioritizes the environment variable, andVcsUrl::parse()can correctly parse the full URL.Impact
--localmode sends"repository": "origin"in the commits payload