mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Add batch script files and enhance git staging logic
- Introduced 20 new batch script files (BatchScript01.luau to BatchScript20.luau) for testing purposes. - Enhanced the `change_processor` to consolidate git staging operations, reducing the risk of index.lock races by batching paths for staging. - Updated the `PatchSet` struct to include a new field for pre-resolved filesystem paths to stage via git add. - Modified the API to handle batch staging more efficiently, ensuring all files are staged correctly in mixed write scenarios. These changes improve the testing framework and optimize git integration for batch operations.
This commit is contained in:
parent
bb4d40c4d3
commit
6de088be31
24 changed files with 272 additions and 13 deletions
|
|
@ -1013,6 +1013,7 @@ impl JobThreadContext {
|
|||
removed_instances: patch_set.removed_instances,
|
||||
updated_instances: Vec::new(),
|
||||
stage_ids: HashSet::new(),
|
||||
stage_paths: Vec::new(),
|
||||
};
|
||||
|
||||
let applied = apply_patch_set(&mut tree, structural_patch);
|
||||
|
|
@ -1027,7 +1028,7 @@ impl JobThreadContext {
|
|||
);
|
||||
}
|
||||
|
||||
fn handle_tree_event(&self, patch_set: PatchSet) {
|
||||
fn handle_tree_event(&self, mut patch_set: PatchSet) {
|
||||
// Log incoming patch summary at debug level
|
||||
log::debug!(
|
||||
"Processing client patch: {} removed, {} added, {} updated",
|
||||
|
|
@ -1308,6 +1309,10 @@ impl JobThreadContext {
|
|||
// Applied after the PatchSet to keep metadata in sync.
|
||||
let mut metadata_updates: Vec<(Ref, PathBuf)> = Vec::new();
|
||||
|
||||
// Paths to stage via git add after all writes complete.
|
||||
// Starts with pre-resolved paths from api.rs, then Source writes are appended.
|
||||
let mut pending_stage_paths = std::mem::take(&mut patch_set.stage_paths);
|
||||
|
||||
for update in &patch_set.updated_instances {
|
||||
let id = update.id;
|
||||
|
||||
|
|
@ -1821,12 +1826,7 @@ impl JobThreadContext {
|
|||
err
|
||||
);
|
||||
} else if patch_set.stage_ids.contains(&id) {
|
||||
if let Some(ref repo_root) = self.git_repo_root {
|
||||
crate::git::git_add(
|
||||
repo_root,
|
||||
std::slice::from_ref(write_path),
|
||||
);
|
||||
}
|
||||
pending_stage_paths.push(write_path.clone());
|
||||
}
|
||||
} else {
|
||||
log::warn!("Cannot change Source to non-string value.");
|
||||
|
|
@ -1898,6 +1898,14 @@ impl JobThreadContext {
|
|||
}
|
||||
}
|
||||
|
||||
// Consolidated git staging: one git_add call for all paths
|
||||
// (pre-resolved from api.rs + Source writes from this function).
|
||||
if !pending_stage_paths.is_empty() {
|
||||
if let Some(ref repo_root) = self.git_repo_root {
|
||||
crate::git::git_add(repo_root, &pending_stage_paths);
|
||||
}
|
||||
}
|
||||
|
||||
applied
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue