mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Enhance git metadata computation with detailed timing logs and refactor untracked file collection
- Added timing logs to various stages of the `compute_git_metadata` function to improve performance monitoring and debugging. - Refactored the `collect_untracked_files` function to utilize a set of tracked directories, optimizing the process of identifying untracked files. - Introduced a new helper function, `compute_blob_object_id`, to streamline blob ID computation for file content. These changes aim to enhance the efficiency and clarity of git metadata handling within the application.
This commit is contained in:
parent
3f1af46fcb
commit
a7f721260b
2 changed files with 155 additions and 39 deletions
|
|
@ -401,13 +401,21 @@ impl ApiService {
|
|||
Vec::new()
|
||||
};
|
||||
|
||||
let git_metadata = self.serve_session.git_repo_root().map(|repo_root| {
|
||||
crate::git::compute_git_metadata(
|
||||
&self.serve_session.tree_handle(),
|
||||
repo_root,
|
||||
self.serve_session.initial_head_commit(),
|
||||
)
|
||||
});
|
||||
let git_metadata = if let Some(repo_root) = self.serve_session.git_repo_root() {
|
||||
let tree_handle = self.serve_session.tree_handle();
|
||||
let repo_root = repo_root.to_owned();
|
||||
let initial_head = self
|
||||
.serve_session
|
||||
.initial_head_commit()
|
||||
.map(|s| s.to_owned());
|
||||
tokio::task::spawn_blocking(move || {
|
||||
crate::git::compute_git_metadata(&tree_handle, &repo_root, initial_head.as_deref())
|
||||
})
|
||||
.await
|
||||
.ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
msgpack_ok(&ServerInfoResponse {
|
||||
server_version: SERVER_VERSION.to_owned(),
|
||||
|
|
@ -429,13 +437,21 @@ impl ApiService {
|
|||
}
|
||||
|
||||
async fn handle_api_git_metadata(&self) -> Response<Full<Bytes>> {
|
||||
let git_metadata = self.serve_session.git_repo_root().map(|repo_root| {
|
||||
crate::git::compute_git_metadata(
|
||||
&self.serve_session.tree_handle(),
|
||||
repo_root,
|
||||
self.serve_session.initial_head_commit(),
|
||||
)
|
||||
});
|
||||
let git_metadata = if let Some(repo_root) = self.serve_session.git_repo_root() {
|
||||
let tree_handle = self.serve_session.tree_handle();
|
||||
let repo_root = repo_root.to_owned();
|
||||
let initial_head = self
|
||||
.serve_session
|
||||
.initial_head_commit()
|
||||
.map(|s| s.to_owned());
|
||||
tokio::task::spawn_blocking(move || {
|
||||
crate::git::compute_git_metadata(&tree_handle, &repo_root, initial_head.as_deref())
|
||||
})
|
||||
.await
|
||||
.ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
msgpack_ok(&git_metadata)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue