MCPcopy Create free account
hub / github.com/alibaba/open-code-review / RemoteIdentity

Method RemoteIdentity

internal/diff/git.go:388–394  ·  view source on GitHub ↗

RemoteIdentity returns a stable, credential-free identity string for the repository's "origin" remote, suitable for hashing into the run manifest's repository.identity_sha256. It reads the configured origin URL and canonicalizes it — dropping any embedded userinfo, query and fragment (so credentials

(ctx context.Context)

Source from the content-addressed store, hash-verified

386// it was cloned. It returns "" when there is no origin remote, or when origin is
387// a local-filesystem remote (the caller then omits repository identity).
388func (p *Provider) RemoteIdentity(ctx context.Context) string {
389 out, err := p.runGit(ctx, "remote", "get-url", "origin")
390 if err != nil {
391 return ""
392 }
393 return canonicalRemote(firstLine(out))
394}
395
396// canonicalRemote reduces a git remote URL to a stable, credential-free identity
397// string for hashing into repository.identity_sha256, so the same repository

Callers 2

loadDiffsMethod · 0.95
TestRemoteIdentityFunction · 0.80

Calls 3

runGitMethod · 0.95
canonicalRemoteFunction · 0.85
firstLineFunction · 0.85

Tested by 1

TestRemoteIdentityFunction · 0.64