From 7a0519768a8662e099c6298ad2a4aa8568c630fb Mon Sep 17 00:00:00 2001 From: Youssef Ibrahim Date: Thu, 12 Dec 2024 06:55:35 -0800 Subject: [PATCH] scs: use into_response to populate file_info in commit_path_info response Summary: `commit_path_info` currently only partially populates `file_info` in its response which can be surprising. Let's use the `into_response` implementation of `FileInfo` instead to fully populate it. Reviewed By: singhsrb Differential Revision: D67140714 fbshipit-source-id: 553feae467571ef399707e3f04e61faff0cc449a --- eden/mononoke/scs/scs_methods/src/methods/commit_path.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/eden/mononoke/scs/scs_methods/src/methods/commit_path.rs b/eden/mononoke/scs/scs_methods/src/methods/commit_path.rs index d37a8be8debd6..3bcdfc3e2b53d 100644 --- a/eden/mononoke/scs/scs_methods/src/methods/commit_path.rs +++ b/eden/mononoke/scs/scs_methods/src/methods/commit_path.rs @@ -93,14 +93,7 @@ impl SourceControlServiceImpl { } } PathEntry::File(file, file_type) => { - let metadata = file.metadata().await?; - let file_info = thrift::FileInfo { - id: metadata.content_id.as_ref().to_vec(), - file_size: metadata.total_size as i64, - content_sha1: metadata.sha1.as_ref().to_vec(), - content_sha256: metadata.sha256.as_ref().to_vec(), - ..Default::default() - }; + let file_info = file.metadata().await?.into_response(); thrift::CommitPathInfoResponse { exists: true, r#type: Some(file_type.into_response()),