zeta: Collect git sha / remote urls when data collection from OSS is enabled (#35514)

Release Notes:

- Edit Prediction: Added Git info to edit predictions requests (only
sent for opensource projects when data collection is enabled). The sent
Git info is the SHA of the current commit and the URLs for the `origin`
and `upstream` remotes.
This commit is contained in:
Michael Sloan 2025-08-04 14:18:06 -06:00 committed by GitHub
parent 3df5394a8c
commit 68c24655e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 70 additions and 2 deletions

View file

@ -246,6 +246,8 @@ pub struct RepositorySnapshot {
pub head_commit: Option<CommitDetails>,
pub scan_id: u64,
pub merge: MergeDetails,
pub remote_origin_url: Option<String>,
pub remote_upstream_url: Option<String>,
}
type JobId = u64;
@ -2673,6 +2675,8 @@ impl RepositorySnapshot {
head_commit: None,
scan_id: 0,
merge: Default::default(),
remote_origin_url: None,
remote_upstream_url: None,
}
}
@ -4818,6 +4822,10 @@ async fn compute_snapshot(
None => None,
};
// Used by edit prediction data collection
let remote_origin_url = backend.remote_url("origin");
let remote_upstream_url = backend.remote_url("upstream");
let snapshot = RepositorySnapshot {
id,
statuses_by_path,
@ -4826,6 +4834,8 @@ async fn compute_snapshot(
branch,
head_commit,
merge: merge_details,
remote_origin_url,
remote_upstream_url,
};
Ok((snapshot, events))