Skip to content

Commit

Permalink
feat: updated ref name for git remote branches
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jun 19, 2024
1 parent 7c42d68 commit 9e40072
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions vcs/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,21 +550,27 @@ func (c *GitClient) GetRemoteRefs(remoteName string) (gitRefs []GitRef, err erro
for _, ref := range refs {
// ref type
var refType string
var gitRef *GitRef
if strings.HasPrefix(ref.Name().String(), "refs/heads") {
refType = GitRefTypeBranch
gitRef = &GitRef{
Type: refType,
Name: remoteName + "/" + ref.Name().Short(),
FullName: ref.Name().String(),
Hash: ref.Hash().String(),
}
} else if strings.HasPrefix(ref.Name().String(), "refs/tags") {
refType = GitRefTypeTag
gitRef = &GitRef{
Type: refType,
Name: ref.Name().Short(),
FullName: ref.Name().String(),
Hash: ref.Hash().String(),
}
} else {
continue
}

// add to branches
gitRefs = append(gitRefs, GitRef{
Type: refType,
Name: ref.Name().Short(),
FullName: ref.Name().String(),
Hash: ref.Hash().String(),
})
gitRefs = append(gitRefs, *gitRef)
}

// logs without tags
Expand Down

0 comments on commit 9e40072

Please sign in to comment.