Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 5, 2025

Users reported "Reference not found" errors when specifying tags in the branch field after upgrading to the Go git client. The issue occurs because GoGitClient.Clone() hardcodes plumbing.NewBranchReferenceName(), which expects refs/heads/* but tags use refs/tags/*.

Changes

  • Added resolveReferenceName() method - Lists remote references to determine if the provided name is a branch or tag, returns appropriate plumbing.ReferenceName
  • Modified Clone() to use resolved reference - Calls resolveReferenceName() before cloning, falls back to branch assumption if resolution fails
  • Added unit tests - Verify reference resolution logic and plumbing reference name creation
// Before: hardcoded branch reference
ReferenceName: plumbing.NewBranchReferenceName(r.Repository.GitBranch),

// After: resolve branch or tag
refName, refErr := c.resolveReferenceName(r)
if refErr != nil {
    r.Logger.Log("Warning: Unable to resolve reference type, assuming branch: " + refErr.Error())
    refName = plumbing.NewBranchReferenceName(r.Repository.GitBranch)
}
ReferenceName: refName,

This aligns GoGitClient behavior with CmdGitClient, where git clone --branch already accepts both branches and tags.

Original prompt

This section details on the original issue you should resolve

<issue_title>Cannot use tag for repo with the new go git client</issue_title>
<issue_description>Hello,

Thank you for this fantastic tool!

I just updated from v2.8.80 to v2.8.89. Previously I was able to set a tag in the branch field when I added a new repo with the new go git client I got an error message with the following: Reference not found.

I am using Semaphore from the Docker environment. Is it possible to use an external git client by specifying an environment variable?</issue_description>

Comments on the Issue (you are @copilot in this section)

@fiftin Yes, will do @fiftin Please check version 2.8.90.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits November 5, 2025 19:06
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tag usage in new go git client Fix GoGitClient to support tags in branch field Nov 5, 2025
Copilot AI requested a review from fiftin November 5, 2025 19:14
Copilot finished work on behalf of fiftin November 5, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot use tag for repo with the new go git client

2 participants