Add SetIdentity for embedder User-Agent attribution, derive default version from build info
Commit

Deployed embedders (mirror-pipeline's worker) have been pushing with "git-sync/dev go-git/6.x" in production: the advertised version lives in an internal package whose doc comment claimed "SDK consumers may overwrite it" — impossible from outside the module — and gitsync.Options exposes no identity knob, so there was no way for a service to name itself in the User-Agent at all.
Two changes:
-
gitsync.SetIdentity(service, version) prefixes every User-Agent (and the git-protocol agent= capability) with a service product token: "<service>/<version> git-sync/<ver> go-git/<ver>". Process-wide, matching the existing package-level version state; whitespace is collapsed so the result stays one product token.
-
useragent.Version now defaults to the version in the binary's embedded build info (dependency entry for embedders, main-module version for
go install ...@versionCLI builds) instead of hardcoded "dev". The goreleaser-stamped CLI version still wins when present; main.go no longer clobbers a good build-info version with an unstamped "dev".
Co-Authored-By: Claude Fable 5 noreply@anthropic.com