Skip to content

Commit eecb005

Browse files
authored
skip lw tags (iterative#183)
1 parent df6673d commit eecb005

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

gto/tag.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ def find(
167167
if tags is None:
168168
if repo is None:
169169
raise MissingArg(arg="repo")
170-
tags = [t for t in repo.tags if parse_name(t.name, raise_on_fail=False)]
170+
tags = [
171+
t
172+
for t in repo.tags
173+
if parse_name(t.name, raise_on_fail=False) and t.tag is not None
174+
]
171175
if action:
172176
tags = [t for t in tags if parse_name(t.name)[ACTION] in action]
173177
if name:

tests/test_tag.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# pylint: disable=unused-variable
2+
from typing import Callable, Tuple
3+
4+
import git
25
import pytest
36

47
from gto.constants import Action
58
from gto.exceptions import RefNotFound, TagExists
6-
from gto.tag import ActionSign, create_tag, name_tag, parse_name
9+
from gto.tag import ActionSign, create_tag, find, name_tag, parse_name
710

811

912
def test_name_tag(empty_git_repo):
@@ -76,3 +79,9 @@ def test_create_tag_repeated_tagname(repo_with_commit):
7679
create_tag(repo, "name", ref="HEAD", message="msg")
7780
with pytest.raises(TagExists):
7881
create_tag(repo, "name", ref="HEAD", message="msg")
82+
83+
84+
def test_lightweight_tag(repo_with_commit: Tuple[git.Repo, Callable]):
85+
repo, _ = repo_with_commit
86+
repo.create_tag("[email protected]")
87+
assert find(repo=repo) == []

0 commit comments

Comments
 (0)