Skip to content

Commit

Permalink
skip lw tags (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
aguschin authored Jun 22, 2022
1 parent df6673d commit eecb005
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gto/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ def find(
if tags is None:
if repo is None:
raise MissingArg(arg="repo")
tags = [t for t in repo.tags if parse_name(t.name, raise_on_fail=False)]
tags = [
t
for t in repo.tags
if parse_name(t.name, raise_on_fail=False) and t.tag is not None
]
if action:
tags = [t for t in tags if parse_name(t.name)[ACTION] in action]
if name:
Expand Down
11 changes: 10 additions & 1 deletion tests/test_tag.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# pylint: disable=unused-variable
from typing import Callable, Tuple

import git
import pytest

from gto.constants import Action
from gto.exceptions import RefNotFound, TagExists
from gto.tag import ActionSign, create_tag, name_tag, parse_name
from gto.tag import ActionSign, create_tag, find, name_tag, parse_name


def test_name_tag(empty_git_repo):
Expand Down Expand Up @@ -76,3 +79,9 @@ def test_create_tag_repeated_tagname(repo_with_commit):
create_tag(repo, "name", ref="HEAD", message="msg")
with pytest.raises(TagExists):
create_tag(repo, "name", ref="HEAD", message="msg")


def test_lightweight_tag(repo_with_commit: Tuple[git.Repo, Callable]):
repo, _ = repo_with_commit
repo.create_tag("lightweight-tag@v0.0.1")
assert find(repo=repo) == []

0 comments on commit eecb005

Please sign in to comment.