X Tutup
Skip to content

feat(gittag): add lsremote parameter to skip git clone#7669

Merged
olblak merged 9 commits intoupdatecli:mainfrom
olblak:issue/7667
Feb 10, 2026
Merged

feat(gittag): add lsremote parameter to skip git clone#7669
olblak merged 9 commits intoupdatecli:mainfrom
olblak:issue/7667

Conversation

@olblak
Copy link
Member

@olblak olblak commented Feb 7, 2026

Fix #7667

When using the gittag plugin with a url value and lsremote set to true, Updatecli now retrieves the tags without cloning the repository locally.
For very large repositories, this drastically reduce the time to get tags, but it also comes with a downside.
Tags retrieved this way are not sorted by publish time so to align with the command git ls-remote --refs --tags https://github.com/updatecli/udash.git behavior, Updatecli sorts them lexicographically.

It turns out that this PR would introduce a breaking change when using the URL parameter, which I don't want to do. Instead, I should probably use a new parameter to enable/disable the new behavior

Test

To test this pull request, you can run the following commands:

cd pkg/plugins/resources/gittag/
go test

Tested with

updatecli.yaml
scms:
  default:
    kind: git
    spec:
      url: https://github.com/updatecli/udash.git

sources:
  listremote1:
    kind: gittag
    spec:
      url: https://github.com/updatecli/udash.git
      lsremote: true
  listremote2:
    kind: gittag
    spec:
      url: https://github.com/updatecli/udash.git
      lsremote: false
  listremote3:
    kind: gittag
    spec:
      url: https://github.com/updatecli/udash.git
  getdir1:
    kind: gittag
    scmid: default
  getdir2:
    kind: gittag
    scmid: default
    spec:
      lsremote: true
  getdir3:
    kind: gittag
    scmid: default
    spec:
      lsremote: false

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

I made the decision to have different behavior if scmid is specified, we get the tags from the local directory.
The major benefits is that tags retrieved this way are sorted by publish time.

Potential improvement

Mock testing to URL with lsremote integration

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak added the enhancement New feature or request label Feb 7, 2026
@olblak olblak requested a review from Copilot February 7, 2026 19:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the gittag resource to retrieve tags from a remote repository URL without cloning it locally, addressing performance issues for large repositories (Fix #7667). It introduces a new remote-tag listing path and adjusts tests/docs accordingly.

Changes:

  • Added remote URL tag listing via go-git remote ref listing (no local clone).
  • Updated Source and Condition to use remote tag listing when spec.url is provided, otherwise use local TagRefs.
  • Extended unit tests and updated spec.url documentation to reflect the new behavior/sorting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
pkg/plugins/resources/gittag/utils.go Adds helpers to list tags from a remote URL or a local directory.
pkg/plugins/resources/gittag/source.go Switches source behavior to avoid cloning when spec.url is set.
pkg/plugins/resources/gittag/condition.go Switches condition behavior to avoid cloning when spec.url is set.
pkg/plugins/resources/gittag/source_test.go Adds test cases for remote URL fetching and updates mocks to TagRefs.
pkg/plugins/resources/gittag/condition_test.go Updates mocks to TagRefs and adds a remote URL condition test.
pkg/plugins/resources/gittag/main.go Updates spec.url documentation to describe the new behavior/sorting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Adding a new parameter lsremote to switch to the new behavior when an
URL is specified, to keep backward compatibility

Signed-off-by: Olblak <me@olblak.com>
@olblak olblak changed the title feat(gittag): allow to not clone repository to get tags feat(gittag): add lsremote parameter to skip git clone Feb 9, 2026
@olblak olblak requested a review from Copilot February 9, 2026 18:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@olblak olblak added the resource-gittag Resource of kind Git Tag label Feb 10, 2026
@olblak olblak enabled auto-merge (squash) February 10, 2026 07:44
@olblak olblak merged commit 4d1521f into updatecli:main Feb 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request resource-gittag Resource of kind Git Tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gittag source clones the full repo just to list the tags

2 participants

X Tutup