From: Junio C Hamano <gitster@pobox.com>
To: "Bence Ferdinandy" <bence@ferdinandy.com>
Cc: "Christian Hesse" <list@eworm.de>,
"Git Mailing List" <git@vger.kernel.org>,
"Christian Hesse" <mail@eworm.de>
Subject: Re: fatal: Not a valid object name HEAD
Date: Mon, 13 Jan 2025 08:30:17 -0800 [thread overview]
Message-ID: <xmqq5xmibrs6.fsf@gitster.g> (raw)
In-Reply-To: <D705QOX6EFH7.14GKFWVVUQWH7@ferdinandy.com> (Bence Ferdinandy's message of "Sun, 12 Jan 2025 15:17:36 +0100")
"Bence Ferdinandy" <bence@ferdinandy.com> writes:
> I think the correct way to handle this would be to check if the remote has
> `mirror=true` set, and if we're running in a bare repository we should overwrite
> HEAD and if it's not a mirror we should instead set up
> `refs/remotes/nonmirrorremote/HEAD`. (I think a remote can be a mirror without
> the repository being bare, I'm not sure.)
A non-bare repository can technically be a mirror but such a thing
is only useful when (1) it never fetches from anywhere afterwards,
(2) it stays on a branch that never changes by convention, or (3) it
stays on a detached HEAD. Otherwise "git fetch" in it would almost
always fail.
Practically (1) and (2) are not all that useful---such a static
checkout does not even have to be a Git repository but a tarball
extract. If you overwrite HEAD upon fetch, you will render the last
remaining useful usage, (3), also useless.
Thanks.
next prev parent reply other threads:[~2025-01-13 16:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 19:26 fatal: Not a valid object name HEAD Christian Hesse
2025-01-12 14:17 ` Bence Ferdinandy
2025-01-13 16:30 ` Junio C Hamano [this message]
2025-01-12 16:51 ` [PATCH] fetch set_head: fix non-mirror remotes in bare repositories Bence Ferdinandy
2025-01-23 21:00 ` Junio C Hamano
2025-01-23 21:42 ` Bence Ferdinandy
2025-01-23 22:00 ` Eric Sunshine
2025-01-24 14:07 ` Christian Hesse
2025-01-24 17:17 ` Junio C Hamano
2025-01-24 5:56 ` Patrick Steinhardt
2025-01-24 10:30 ` Eric Sunshine
2025-01-24 16:07 ` Junio C Hamano
2025-01-26 22:01 ` Bence Ferdinandy
2025-01-26 22:01 ` Bence Ferdinandy
2025-01-26 22:02 ` [PATCH v2 1/2] fetch set_head: refactor to use remote directly Bence Ferdinandy
2025-01-26 22:02 ` [PATCH v2 2/2] fetch set_head: fix non-mirror remotes in bare repositories Bence Ferdinandy
2025-01-27 7:30 ` Patrick Steinhardt
2025-01-27 20:18 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5xmibrs6.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=bence@ferdinandy.com \
--cc=git@vger.kernel.org \
--cc=list@eworm.de \
--cc=mail@eworm.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.