diff --git a/gto/registry.py b/gto/registry.py index f9d9ce3e..eadb8936 100644 --- a/gto/registry.py +++ b/gto/registry.py @@ -299,8 +299,14 @@ def assign( # pylint: disable=too-many-locals raise WrongArgs( f"Can't register '{SemVer(name_version).version}', since '{found_version.version}' is registered already at this ref" ) - elif not skip_registration: - self.register(name, version=name_version, ref=ref, stdout=stdout) + else: + if not skip_registration: + self.register( + name, version=name_version, ref=ref, simple=True, stdout=stdout + ) + found_version = self.find_artifact(name, create_new=True).find_version( + commit_hexsha=ref, create_new=True + ) if ( not force and found_version diff --git a/tests/test_cli.py b/tests/test_cli.py index 4dde3825..1c7862b4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -364,3 +364,14 @@ def test_assign(repo_with_commit: Tuple[git.Repo, Callable]): ], "❌ Version '1.0.0' is not valid. Example of valid version: 'v1.0.0'\n", ) + + _check_successful_cmd( + "assign", + ["-r", repo.working_dir, "nn2", "HEAD", "--stage", "prod"], + "Created git tag 'nn2@v0.0.1' that registers version\n" + "To push the changes upstream, run:\n" + " git push nn2@v0.0.1\n" + "Created git tag 'nn2#prod#1' that assigns stage to version 'v0.0.1'\n" + "To push the changes upstream, run:\n" + " git push nn2#prod#1\n", + )