mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Enhance git metadata handling and improve change detection logic
- Introduced a new function `getGitMetadata` in `ApiContext` to fetch current git metadata, including new file IDs. - Updated the `PatchTree.build` function to handle new file IDs, allowing for better differentiation between tracked and untracked files during patch processing. - Modified the `git_changed_files` function to return both tracked and untracked files, improving accuracy in change detection. - Enhanced the `App` component to debounce git metadata refreshes, ensuring the UI reflects the latest changes without unnecessary calls. These changes aim to improve the integration with git and enhance the accuracy of change detection in the application.
This commit is contained in:
parent
b8bd92d665
commit
640b2d3d97
7 changed files with 128 additions and 30 deletions
|
|
@ -160,6 +160,7 @@ pub async fn call(
|
|||
handle_api_syncback(request, &service, syncback_signal).await
|
||||
}
|
||||
(&Method::GET, "/api/validate-tree") => service.handle_api_validate_tree().await,
|
||||
(&Method::GET, "/api/git-metadata") => service.handle_api_git_metadata().await,
|
||||
|
||||
(_method, path) => msgpack(
|
||||
ErrorResponse::not_found(format!("Route not found: {}", path)),
|
||||
|
|
@ -405,6 +406,18 @@ 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(),
|
||||
)
|
||||
});
|
||||
|
||||
msgpack_ok(&git_metadata)
|
||||
}
|
||||
|
||||
/// Read-only tree freshness check for test infrastructure.
|
||||
/// Re-snapshots from disk and returns drift counts without applying corrections.
|
||||
async fn handle_api_validate_tree(&self) -> Response<Full<Bytes>> {
|
||||
|
|
|
|||
|
|
@ -214,6 +214,11 @@ pub struct GitMetadata {
|
|||
/// SHA1 hashes of prior versions (git blob format) for changed script instances.
|
||||
/// Contains 1-2 hashes per script: HEAD version and staged version (if different).
|
||||
pub script_committed_hashes: HashMap<Ref, Vec<String>>,
|
||||
/// Instance IDs whose backing files are untracked in git (truly new files,
|
||||
/// never committed). Used by the plugin to default new-file additions to
|
||||
/// "push" (Atlas) since they can't be "something Studio deleted."
|
||||
#[serde(default)]
|
||||
pub new_file_ids: Vec<Ref>,
|
||||
}
|
||||
|
||||
/// Response body from /api/rojo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue