Skip to content
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

tags aren't fetched when fetching specific commit #146

Open
MacMalainey opened this issue Jan 27, 2025 · 3 comments
Open

tags aren't fetched when fetching specific commit #146

MacMalainey opened this issue Jan 27, 2025 · 3 comments
Assignees

Comments

@MacMalainey
Copy link

When running the following commands zopen git doesn't report the proper information

mkdir git-test-dir
cd git-test-dir
git init --bare
git remote add origin -- https://github.com/golang/go
git -c protocol.version=2 fetch -f --depth=1 origin 16afa6a740fac7442e94dcd2ec5ea4a4853e45dc:refs/dummy
git -c log.showsignature=false log --no-decorate -n1 --format="format:%H %ct %D" 16afa6a740fac7442e94dcd2ec5ea4a4853e45dc --

# Expected:
# 16afa6a740fac7442e94dcd2ec5ea4a4853e45dc 1734108730 grafted, tag: go1.24rc1, refs/dummy

# Got using zopen:
# 16afa6a740fac7442e94dcd2ec5ea4a4853e45dc 1734108730 grafted

Using protocol.version=2 is supposed to fix this issue but that doesn't seem to work on zopen git.

It may be related to this:
https://lore.kernel.org/git/20240124010056.GA2603087@coredump.intra.peff.net/

@IgorTodorovskiIBM IgorTodorovskiIBM self-assigned this Jan 27, 2025
@IgorTodorovskiIBM
Copy link
Collaborator

I was able to reproduce this on both Mac and Linux with Git 2.48.1.

Adjusting the protocol.version to protocol.version=1 gets the expected output for Git 2.48.1

@IgorTodorovskiIBM
Copy link
Collaborator

Seems to have regressed from Git 2.47.1

@IgorTodorovskiIBM
Copy link
Collaborator

git bisect reveals 3f763ddf28d28fe63963991513c8db4045eabadc as the culprit:

commit 3f763ddf28d28fe63963991513c8db4045eabadc
Author: Bence Ferdinandy <bence@ferdinandy.com>
Date:   Fri Nov 22 13:28:50 2024 +0100

    fetch: set remote/HEAD if it does not exist

    When cloning a repository remote/HEAD is created, but when the user
    creates a repository with git init, and later adds a remote, remote/HEAD
    is only created if the user explicitly runs a variant of "remote
    set-head". Attempt to set remote/HEAD during fetch, if the user does not
    have it already set. Silently ignore any errors.

    Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

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

No branches or pull requests

2 participants