diff --git a/apps/desktop/src/lib/backend/projects.ts b/apps/desktop/src/lib/backend/projects.ts index 8001c987d..be003001b 100644 --- a/apps/desktop/src/lib/backend/projects.ts +++ b/apps/desktop/src/lib/backend/projects.ts @@ -29,7 +29,7 @@ export class Project { omit_certificate_check: boolean | undefined; use_diff_context: boolean | undefined; snapshot_lines_threshold!: number | undefined; - use_new_locking!: boolean; + use_experimental_locking!: boolean; git_host!: { hostType: HostType | undefined; reviewTemplatePath: string | undefined; diff --git a/apps/desktop/src/lib/settings/userPreferences/CommitSigningForm.svelte b/apps/desktop/src/lib/settings/userPreferences/CommitSigningForm.svelte index ed1434dd3..c93b8a02f 100644 --- a/apps/desktop/src/lib/settings/userPreferences/CommitSigningForm.svelte +++ b/apps/desktop/src/lib/settings/userPreferences/CommitSigningForm.svelte @@ -18,7 +18,7 @@ const projectsService = getContext(ProjectsService); const project = getContext(Project); - let useNewLocking = project?.use_new_locking || false; + let useNewLocking = project?.use_experimental_locking || false; let signCommits = false; const gitConfig = getContext(GitConfigService); @@ -78,7 +78,7 @@ } async function setUseNewLocking(value: boolean) { - project.use_new_locking = value; + project.use_experimental_locking = value; await projectsService.updateProject(project); } diff --git a/apps/desktop/src/lib/settings/userPreferences/PreferencesForm.svelte b/apps/desktop/src/lib/settings/userPreferences/PreferencesForm.svelte index 63af520d5..912e7806d 100644 --- a/apps/desktop/src/lib/settings/userPreferences/PreferencesForm.svelte +++ b/apps/desktop/src/lib/settings/userPreferences/PreferencesForm.svelte @@ -13,7 +13,7 @@ let snaphotLinesThreshold = project?.snapshot_lines_threshold || 20; // when undefined, the default is 20 let omitCertificateCheck = project?.omit_certificate_check; - let useNewLocking = project?.use_new_locking || false; + let useNewLocking = project?.use_experimental_locking || false; const runCommitHooks = projectRunCommitHooks(project.id); @@ -28,7 +28,7 @@ } async function setUseNewLocking(value: boolean) { - project.use_new_locking = value; + project.use_experimental_locking = value; await projectsService.updateProject(project); } diff --git a/crates/gitbutler-branch-actions/src/status.rs b/crates/gitbutler-branch-actions/src/status.rs index 31096eb61..97e12d499 100644 --- a/crates/gitbutler-branch-actions/src/status.rs +++ b/crates/gitbutler-branch-actions/src/status.rs @@ -98,7 +98,7 @@ pub fn get_applied_status_cached( let vb_state = ctx.project().virtual_branches(); let default_target = vb_state.get_default_target()?; - let locks = if ctx.project().use_new_locking { + let locks = if ctx.project().use_experimental_locking { compute_locks( ctx, &workspace_head, diff --git a/crates/gitbutler-branch-actions/tests/virtual_branches/mod.rs b/crates/gitbutler-branch-actions/tests/virtual_branches/mod.rs index f181eb677..87265ae03 100644 --- a/crates/gitbutler-branch-actions/tests/virtual_branches/mod.rs +++ b/crates/gitbutler-branch-actions/tests/virtual_branches/mod.rs @@ -34,7 +34,7 @@ impl Default for Test { .add(test_project.path()) .expect("failed to add project"); // TODO: Remove after transition is complete. - project.use_new_locking = true; + project.use_experimental_locking = true; Self { repository: test_project, diff --git a/crates/gitbutler-project/src/project.rs b/crates/gitbutler-project/src/project.rs index b69499e86..a52ccf1bb 100644 --- a/crates/gitbutler-project/src/project.rs +++ b/crates/gitbutler-project/src/project.rs @@ -98,8 +98,13 @@ pub struct Project { #[serde(default)] pub git_host: GitHostSettings, // Experimental flag for new hunk dependency algorithm - #[serde(default)] - pub use_new_locking: bool, + #[serde(default = "default_true")] + pub use_experimental_locking: bool, +} + +// TODO: Remove after `use_experimental` has been removed. +fn default_true() -> bool { + true } #[derive(Debug, Deserialize, Serialize, Clone, Default)] diff --git a/crates/gitbutler-project/src/storage.rs b/crates/gitbutler-project/src/storage.rs index b8abbdf76..6ae6c1855 100644 --- a/crates/gitbutler-project/src/storage.rs +++ b/crates/gitbutler-project/src/storage.rs @@ -28,7 +28,7 @@ pub struct UpdateRequest { pub use_diff_context: Option, pub snapshot_lines_threshold: Option, pub git_host: Option, - pub use_new_locking: Option, + pub use_experimental_locking: Option, } impl Storage { @@ -129,8 +129,8 @@ impl Storage { project.git_host = git_host.clone(); } - if let Some(use_new_locking) = &update_request.use_new_locking { - project.use_new_locking = *use_new_locking; + if let Some(use_experimental_locking) = &update_request.use_experimental_locking { + project.use_experimental_locking = *use_experimental_locking; } self.inner