(
&self,
working_copy: WorkingCopyId,
target: &EffectTarget,
)
| 3760 | } |
| 3761 | |
| 3762 | fn filesystem_effect_path( |
| 3763 | &self, |
| 3764 | working_copy: WorkingCopyId, |
| 3765 | target: &EffectTarget, |
| 3766 | ) -> Result<Option<PathBuf>, RepositoryError> { |
| 3767 | match target { |
| 3768 | EffectTarget::FilesystemPath { path } => { |
| 3769 | let content_store_effect = |
| 3770 | Path::new(path).starts_with(Path::new(".atomic/changes")); |
| 3771 | // CB-13B R2: `.git/hooks/<name>` is the one `.git`-rooted |
| 3772 | // surface a journaled effect may target — the hook |
| 3773 | // decommission migration lease. Exactly one hook-file |
| 3774 | // component; the effect machinery's symlink-parent checks |
| 3775 | // and per-ordinal backups apply unchanged. |
| 3776 | let git_hook_effect = is_git_hooks_effect_path(path); |
| 3777 | let relative = |
| 3778 | validate_relative_path(path, content_store_effect || git_hook_effect)?; |
| 3779 | if relative.starts_with(Path::new(".atomic")) |
| 3780 | && !relative.starts_with(Path::new(".atomic/changes")) |
| 3781 | { |
| 3782 | return Err(RepositoryError::InvalidOperation { |
| 3783 | message: format!("operation filesystem effect cannot target '{path}'"), |
| 3784 | }); |
| 3785 | } |
| 3786 | resolve_without_symlink_parents(&self.root, &relative).map(Some) |
| 3787 | } |
| 3788 | EffectTarget::WorkspacePath { |
| 3789 | working_copy: target_working_copy, |
| 3790 | path, |
| 3791 | } => { |
| 3792 | if *target_working_copy != working_copy { |
| 3793 | return Err(RepositoryError::InvalidOperation { |
| 3794 | message: format!( |
| 3795 | "workspace effect belongs to working copy {target_working_copy}, operation lock is for {working_copy}" |
| 3796 | ), |
| 3797 | }); |
| 3798 | } |
| 3799 | let relative = validate_relative_path(path, false)?; |
| 3800 | resolve_without_symlink_parents(&self.root, &relative).map(Some) |
| 3801 | } |
| 3802 | EffectTarget::ShelfPath { |
| 3803 | working_copy: target_working_copy, |
| 3804 | view, |
| 3805 | path, |
| 3806 | } => { |
| 3807 | if *target_working_copy != working_copy { |
| 3808 | return Err(RepositoryError::InvalidOperation { |
| 3809 | message: format!( |
| 3810 | "shelf effect belongs to working copy {target_working_copy}, operation lock is for {working_copy}" |
| 3811 | ), |
| 3812 | }); |
| 3813 | } |
| 3814 | let view = validate_relative_path(view, true)?; |
| 3815 | let path = validate_relative_path(path, true)?; |
| 3816 | let base = self |
| 3817 | .dot_dir |
| 3818 | .join("working-copies") |
| 3819 | .join(working_copy.to_string()) |
no test coverage detected