From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] refs/files: deprecate writing symrefs as symbolic links
Date: Wed, 15 Oct 2025 07:59:17 +0200 [thread overview]
Message-ID: <aO84NamCzFXH1eUl@pks.im> (raw)
In-Reply-To: <xmqqplapxur0.fsf@gitster.g>
On Tue, Oct 14, 2025 at 10:23:31AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> > +* Support for `core.preferSymlinkRefs=true` has been deprecated and will be
> > + removed in Git 3.0. If set, symbolic refs like "HEAD" would be written as
> > + symbolic links instead of as a plain file using the symref format.
>
> The second sentence reads as if we are talking about a newly
> introduced feature, but I cannot quite rephrase it to avoid that
> impression myself.
How about:
Support for `core.preferSymlinkRefs=true` has been deprecated and will be
removed in Git 3.0. Writing symbolic refs as symbolic links will be phased
out in favor of using plain files using the textual representation of
symbolic refs.
> > +Note that for now, only the writing side for such symbolic links is deprecated.
> > +Reading such symbolic links is still supported for now.
>
> Double "for now". Let's start the above with "Note that only the ...".
Yup.
> > diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc
> > index 08739bb9d42..e9272bbc0bd 100644
> > --- a/Documentation/config/core.adoc
> > +++ b/Documentation/config/core.adoc
> > @@ -290,6 +290,9 @@ core.preferSymlinkRefs::
> > and other symbolic reference files, use symbolic links.
> > This is sometimes needed to work with old scripts that
> > expect HEAD to be a symbolic link.
> > ++
> > +This configuration is deprecated and will be removed in Git 3.0. Writing
> > +symbolic links for symrefs will not be supported anymore.
>
> Or spinning it a bit positively:
>
> Symbolic refs will always be written as textual symrefs.
Okay.
> > -#ifdef NO_SYMLINK_HEAD
> > +#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)
> > #define create_ref_symlink(a, b) (-1)
>
> Perhaps we want to say NOT_CONSTANT(-1) here?
We do have `NOT_CONSTANT()` at the callsite, as introduced by Johannes.
I don't really see a reason to change that now.
> > #else
> > static int create_ref_symlink(struct ref_lock *lock, const char *target)
> > {
> > + static int warn_once = 1;
> > + char *ref_path;
> > int ret = -1;
> >
> > - char *ref_path = get_locked_file_path(&lock->lk);
> > + if (warn_once)
> > + warning(_("'core.preferSymlinkRefs=true' is nominated for removal.\n"
> > + "hint: The use of symbolic links for symbolic refs is deprecated\n"
> > + "hint: and will be removed in Git 3.0. The configuration that\n"
> > + "hint: tells Git to use them is thus going away. You can unset\n"
> > + "hint: it with:\n"
> > + "hint:\n"
> > + "hint:\tgit config unset core.preferSymlinkRefs\n"
> > + "hint:\n"
> > + "hint: Git will then use the symref format instead."));
>
> I've always called them "textual symref" when I needed to
> differenciate them from symbolic links. I haven't seen "symref
> format", though. Do we have an official terminology?
I don't think we do. I'll say "textual symref format" here.
> > + warn_once = 0;
> > +
> > + ref_path = get_locked_file_path(&lock->lk);
>
> Was there a reason why we want to first warn and then attempt to
> lock? We are afraid that we may die before we have a chance to
> warn()?
No particular reason, no. Happy to move it towards the end so that error
messages are given preference.
Thanks!
Patrick
next prev parent reply other threads:[~2025-10-15 5:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 8:17 [PATCH] refs/files: deprecate writing symrefs as symbolic links Patrick Steinhardt
2025-10-14 17:23 ` Junio C Hamano
2025-10-15 5:59 ` Patrick Steinhardt [this message]
2025-10-15 14:49 ` Junio C Hamano
2025-10-15 6:26 ` [PATCH v2] " Patrick Steinhardt
2025-10-15 16:15 ` Junio C Hamano
2025-10-23 20:54 ` 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=aO84NamCzFXH1eUl@pks.im \
--to=ps@pks.im \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).