Skip to content

Properly fetch tags #2200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

svaningelgem
Copy link

@svaningelgem svaningelgem commented Jun 10, 2025

Closes #1467
Closes #1471
Closes #1662
Closes #1781
Closes #2039
Closes #2041
Closes #2106
Closes #2127
Closes #2199

This fix would allow one to specify fetch-tags.
Right now, it doesn't work as advertised (ie: no tags were fetched, even when configured as true)

With this change, it'll add a "--tags" cli entry, which will fetch the tags - regardless of the provided depth.

EDIT: after checking the other tickets and @TingluoHuang 's comment in #2039, I dug deeper and provided an all-encompassing fix for the wrong behaviour in git 2.48.

@svaningelgem svaningelgem requested a review from a team as a code owner June 10, 2025 06:48
@svaningelgem
Copy link
Author

svaningelgem commented Jun 10, 2025

Just saw a lot of PRs for the same:
But I checked a bit with different executables and it seems this is purely an issue with the 2.48-versions:

The launched command was always:

$GIT_BIN -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=1 --tags origin +3041a467946a2a31694e3ab6323d6a3e105d9bda:refs/remotes/pull
2.47.1: no problem
Using git version: git version 2.47.1
Initialized empty Git repository in /home/steven/gitbuild/test-7/.git/
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (278/278), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 278 (delta 95), reused 209 (delta 43), pack-reused 0 (from 0)
Receiving objects: 100% (278/278), 121.49 KiB | 846.00 KiB/s, done.
Resolving deltas: 100% (95/95), done.
From https://github.com/AvarionMC/yaml
 * [new ref]         3041a467946a2a31694e3ab6323d6a3e105d9bda -> pull
 * [new tag]         1.0.0                                    -> 1.0.0
 * [new tag]         1.1.0                                    -> 1.1.0
 * [new tag]         1.1.1                                    -> 1.1.1
 * [new tag]         1.1.2                                    -> 1.1.2
 * [new tag]         1.1.3                                    -> 1.1.3
 * [new tag]         1.1.4                                    -> 1.1.4
 * [new tag]         1.1.5                                    -> 1.1.5
 * [new tag]         1.1.6                                    -> 1.1.6
 * [new tag]         1.1.7                                    -> 1.1.7
 * [new tag]         1.1.8                                    -> 1.1.8
 * [new tag]         1.1.9                                    -> 1.1.9
2.48.0: problem
Using git version: git version 2.48.0
Initialized empty Git repository in /home/steven/gitbuild/test-8/.git/
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 88 (delta 18), reused 65 (delta 14), pack-reused 0 (from 0)
Unpacking objects: 100% (88/88), 92.57 KiB | 504.00 KiB/s, done.
From https://github.com/AvarionMC/yaml
 * [new ref]         3041a467946a2a31694e3ab6323d6a3e105d9bda -> pull
2.48.1: problem
Using git version: git version 2.48.1
Initialized empty Git repository in /home/steven/gitbuild/test-81/.git/
remote: Enumerating objects: 88, done.
remote: Counting objects: 100% (88/88), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 88 (delta 18), reused 65 (delta 14), pack-reused 0 (from 0)
Unpacking objects: 100% (88/88), 92.57 KiB | 298.00 KiB/s, done.
From https://github.com/AvarionMC/yaml
 * [new ref]         3041a467946a2a31694e3ab6323d6a3e105d9bda -> pull
2.49.0: no problem
Using git version: git version 2.49.0
Initialized empty Git repository in /home/steven/gitbuild/test/.git/
remote: Enumerating objects: 278, done.
remote: Counting objects: 100% (278/278), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 278 (delta 95), reused 209 (delta 43), pack-reused 0 (from 0)
Receiving objects: 100% (278/278), 121.12 KiB | 375.00 KiB/s, done.
Resolving deltas: 100% (95/95), done.
From https://github.com/AvarionMC/yaml
 * [new ref]         3041a467946a2a31694e3ab6323d6a3e105d9bda -> pull
 * [new tag]         1.0.0                                    -> 1.0.0
 * [new tag]         1.1.0                                    -> 1.1.0
 * [new tag]         1.1.1                                    -> 1.1.1
 * [new tag]         1.1.2                                    -> 1.1.2
 * [new tag]         1.1.3                                    -> 1.1.3
 * [new tag]         1.1.4                                    -> 1.1.4
 * [new tag]         1.1.5                                    -> 1.1.5
 * [new tag]         1.1.6                                    -> 1.1.6
 * [new tag]         1.1.7                                    -> 1.1.7
 * [new tag]         1.1.8                                    -> 1.1.8
 * [new tag]         1.1.9                                    -> 1.1.9

@ASHISHs21
Copy link

Great investigation, and thanks for going the extra mile to test across multiple Git versions.

Confirming from the logs:

2.47.1 and 2.49.0 correctly fetch tags as expected

2.48.0 and 2.48.1 fail to fetch tags even with --tags

This validates that the issue is specific to the 2.48.x series and not related to actions/checkout logic directly — but it's great to see this PR work around that inconsistency with a robust fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants