You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/08/05 19:54:40 UTC

(tooling-trusted-releases) branch sbp updated: Allow the form to move files to accept the root directory

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new b57b48b5 Allow the form to move files to accept the root directory
b57b48b5 is described below

commit b57b48b5594df191aeb3063b9409b0f1af778e76
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed Aug 5 20:54:00 2026 +0100

    Allow the form to move files to accept the root directory
---
 atr/models/safe.py             | 7 +++++++
 atr/shared/compose.py          | 2 +-
 atr/storage/writers/release.py | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/atr/models/safe.py b/atr/models/safe.py
index 12919efe..afdabd78 100644
--- a/atr/models/safe.py
+++ b/atr/models/safe.py
@@ -300,6 +300,13 @@ class RelPath(SafeType):
         return self.as_path() >= other.as_path()
 
 
+class RelDirPath(RelPath):
+    def _additional_validations(self, value: str) -> None:
+        if value == ".":
+            return
+        super()._additional_validations(value)
+
+
 class RevisionNumber(Numeric):
     """A revision number that has been validated for safety."""
 
diff --git a/atr/shared/compose.py b/atr/shared/compose.py
index eb0daf72..3dabab73 100644
--- a/atr/shared/compose.py
+++ b/atr/shared/compose.py
@@ -32,7 +32,7 @@ type MOVE_FILE = Literal["MOVE_FILE"]
 class MoveFileForm(form.Form):
     variant: MOVE_FILE = form.value(MOVE_FILE)
     source_files: form.RelPathList = form.label("Files to move")
-    target_directory: safe.RelPath = form.label("Target directory")
+    target_directory: safe.RelDirPath = form.label("Target directory")
 
     @pydantic.model_validator(mode="after")
     def validate_move(self) -> "MoveFileForm":
diff --git a/atr/storage/writers/release.py b/atr/storage/writers/release.py
index 1115f440..be30c8ff 100644
--- a/atr/storage/writers/release.py
+++ b/atr/storage/writers/release.py
@@ -1030,7 +1030,7 @@ class CommitteeParticipant(FoundationCommitter):
         full_source_item_path: safe.StatePath = interim_path / source_path
 
         if await aiofiles.os.path.isdir(full_source_item_path):
-            if (target_dir_rel == source_file_rel) or (interim_path / target_dir_path).path.resolve().is_relative_to(
+            if (target_dir_rel == source_file_rel) or target_path.path.resolve().is_relative_to(
                 full_source_item_path.path.resolve()
             ):
                 raise datatypes.FailedError("Cannot move a directory into itself or a subdirectory of itself")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org