From d4b390a3ec2422d18e83230ba0b9a024ef30fcdf Mon Sep 17 00:00:00 2001 From: Joe Date: Sat, 28 Feb 2026 11:36:15 -0600 Subject: [PATCH] Refactor script class handling and improve imports in git.rs and ref_properties.rs - Moved the `is_script_class` function to the `snapshot` module for better organization and reusability. - Updated imports in `git.rs` and `ref_properties.rs` to reflect the new location of `is_script_class`, enhancing code clarity and maintainability. These changes aim to streamline script class management and improve the overall structure of the codebase. --- src/git.rs | 11 ++++------- src/syncback/ref_properties.rs | 5 +---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/git.rs b/src/git.rs index 9c19ad49..0fc8e560 100644 --- a/src/git.rs +++ b/src/git.rs @@ -10,13 +10,10 @@ use std::{ use rbx_dom_weak::types::Ref; use sha1::{Digest, Sha1}; -use crate::{snapshot::RojoTree, web::interface::GitMetadata}; - -const SCRIPT_CLASSES: &[&str] = &["Script", "LocalScript", "ModuleScript"]; - -fn is_script_class(class: &str) -> bool { - SCRIPT_CLASSES.contains(&class) -} +use crate::{ + snapshot::{is_script_class, RojoTree}, + web::interface::GitMetadata, +}; pub fn git_repo_root(project_root: &Path) -> Option { let output = Command::new("git") diff --git a/src/syncback/ref_properties.rs b/src/syncback/ref_properties.rs index cc54a3a2..b62ce232 100644 --- a/src/syncback/ref_properties.rs +++ b/src/syncback/ref_properties.rs @@ -11,6 +11,7 @@ use rbx_dom_weak::{ use crate::{ ref_attribute_name, ref_target_attribute_name, + snapshot::is_script_class, syncback::{name_needs_slugify, slugify_name}, REF_ID_ATTRIBUTE_NAME, REF_PATH_ATTRIBUTE_PREFIX, REF_POINTER_ATTRIBUTE_PREFIX, }; @@ -131,10 +132,6 @@ fn tentative_fs_name(inst: &Instance) -> String { format!("{slug}.{extension}") } -fn is_script_class(class: &str) -> bool { - matches!(class, "Script" | "LocalScript" | "ModuleScript") -} - pub struct RefLinks { /// Refs that use path-based linking (path is unique). path_links: HashMap>,