Skip to content

Commit 2cbeef5

Browse files
authored
Merge pull request #5 from greboid/master
2 parents a750460 + ee09944 commit 2cbeef5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

refs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ func Fetch(url string, options ...Option) (map[string]string, error) {
9595
parts := strings.SplitN(string(line), " ", 2)
9696
hash := parts[0]
9797
ref := strings.TrimSpace(strings.SplitN(parts[1], "\000", 2)[0])
98+
if strings.HasSuffix(ref, "^{}") {
99+
continue
100+
}
98101
if !o.tagsOnly || strings.HasPrefix(ref, tagPrefix) {
99102
refs[ref] = hash
100103
}

tags_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ func Test_latestTag(t *testing.T) {
5151
"refs/tags/v1.0.0": commit1,
5252
"refs/tags/1.0.0": commit2,
5353
}, "", "1.0.0", commit2, false},
54+
{"Dereferenced tags should be filtered", map[string]string{
55+
"refs/tags/v1.0.0": commit1,
56+
"refs/tags/v1.0.0^{}": commit2,
57+
"refs/tags/v1.0.1": commit3,
58+
}, "", "v1.0.1", commit3, false},
5459
}
5560
for _, tt := range tests {
5661
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)