{"thread":{"id":"64316","subject":"[PATCH] refs/files: deprecate writing symrefs as symbolic links","startedAt":"2025-10-14T08:17:26Z","lastAt":"2025-10-23T20:54:13Z","messageCount":7,"participants":["Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"528690","messageId":"20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im","threadId":"64316","inReplyTo":null,"subject":"[PATCH] refs/files: deprecate writing symrefs as symbolic links","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-10-14T08:17:14Z","receivedAt":"2025-10-14T08:17:26Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The \"files\" backend has the ability to store symbolic refs as symbolic\nlinks, which can be configured via \"core.preferSymlinkRefs\". This\nfeature stems back from the early days: the initial implementation of\nsymbolic refs used symlinks exclusively. The symref format was only\nintroduced in 9b143c6e15 (Teach update-ref about a symbolic ref stored\nin a textfile., 2005-09-25) and made the default in 9f0bb90d16\n(core.prefersymlinkrefs: use symlinks for .git/HEAD, 2006-05-02).\n\nThis is all about 20 years ago, and there are no known reasons nowadays\nwhy one would want to use symlinks instead of symrefs. Mark the feature\nfor deprecation in Git 3.0.\n\nNote that this only deprecates _writing_ symrefs as symbolic links.\nReading such symrefs is still supported for now.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\nHi,\n\nas discussed in [1], this small patch deprecates\n\"core.preferSymlinkRefs\". Thanks!\n\nPatrick\n\n[1]: <xmqqzf9zddia.fsf@gitster.g>\n---\n Documentation/BreakingChanges.adoc | 18 ++++++++++++++++++\n Documentation/config/core.adoc     |  3 +++\n refs/files-backend.c               | 18 ++++++++++++++++--\n t/t0600-reffiles-backend.sh        | 26 +++++++++++++++++++++++---\n 4 files changed, 60 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc\nindex 90b53abcea2..8178d06417b 100644\n--- a/Documentation/BreakingChanges.adoc\n+++ b/Documentation/BreakingChanges.adoc\n@@ -295,6 +295,24 @@ The command will be removed.\n +\n cf. <xmqqa59i45wc.fsf@gitster.g>\n \n+* Support for `core.preferSymlinkRefs=true` has been deprecated and will be\n+  removed in Git 3.0. If set, symbolic refs like \"HEAD\" would be written as\n+  symbolic links instead of as a plain file using the symref format.\n++\n+Symbolic references were initially always stored as a symbolic link. This was\n+changed in 9b143c6e15 (Teach update-ref about a symbolic ref stored in a\n+textfile., 2005-09-25), where a new symref format was introduced to store those\n+symbolic refs in a plain file. In 9f0bb90d16 (core.prefersymlinkrefs: use\n+symlinks for .git/HEAD, 2006-05-02), the Git project switched the default to use\n+the symref format in favor of symbolic links.\n++\n+The migration away from symbolic links has happened almost 20 years ago by now,\n+and there is no known reason why one should prefer them nowadays. Furthermore,\n+symbolic links are not supported on some platforms.\n++\n+Note that for now, only the writing side for such symbolic links is deprecated.\n+Reading such symbolic links is still supported for now.\n+\n == Superseded features that will not be deprecated\n \n Some features have gained newer replacements that aim to improve the design in\ndiff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc\nindex 08739bb9d42..e9272bbc0bd 100644\n--- a/Documentation/config/core.adoc\n+++ b/Documentation/config/core.adoc\n@@ -290,6 +290,9 @@ core.preferSymlinkRefs::\n \tand other symbolic reference files, use symbolic links.\n \tThis is sometimes needed to work with old scripts that\n \texpect HEAD to be a symbolic link.\n++\n+This configuration is deprecated and will be removed in Git 3.0. Writing\n+symbolic links for symrefs will not be supported anymore.\n \n core.alternateRefsCommand::\n \tWhen advertising tips of available history from an alternate, use the shell to\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 3e46386531d..b14e0af219e 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -2114,14 +2114,28 @@ static int commit_ref_update(struct files_ref_store *refs,\n \treturn 0;\n }\n \n-#ifdef NO_SYMLINK_HEAD\n+#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)\n #define create_ref_symlink(a, b) (-1)\n #else\n static int create_ref_symlink(struct ref_lock *lock, const char *target)\n {\n+\tstatic int warn_once = 1;\n+\tchar *ref_path;\n \tint ret = -1;\n \n-\tchar *ref_path = get_locked_file_path(&lock->lk);\n+\tif (warn_once)\n+\t\twarning(_(\"'core.preferSymlinkRefs=true' is nominated for removal.\\n\"\n+\t\t\t  \"hint: The use of symbolic links for symbolic refs is deprecated\\n\"\n+\t\t\t  \"hint: and will be removed in Git 3.0. The configuration that\\n\"\n+\t\t\t  \"hint: tells Git to use them is thus going away. You can unset\\n\"\n+\t\t\t  \"hint: it with:\\n\"\n+\t\t\t  \"hint:\\n\"\n+\t\t\t  \"hint:\\tgit config unset core.preferSymlinkRefs\\n\"\n+\t\t\t  \"hint:\\n\"\n+\t\t\t  \"hint: Git will then use the symref format instead.\"));\n+\twarn_once = 0;\n+\n+\tref_path = get_locked_file_path(&lock->lk);\n \tunlink(ref_path);\n \tret = symlink(target, ref_path);\n \tfree(ref_path);\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 1e62c791d97..560cdfe1d66 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -477,9 +477,29 @@ test_expect_success SYMLINKS 'symref transaction supports symlinks' '\n \tprepare\n \tcommit\n \tEOF\n-\tgit update-ref --no-deref --stdin <stdin &&\n-\ttest_path_is_symlink .git/TEST_SYMREF_HEAD &&\n-\ttest \"$(test_readlink .git/TEST_SYMREF_HEAD)\" = refs/heads/new\n+\tgit update-ref --no-deref --stdin <stdin 2>err &&\n+\tif test_have_prereq WITH_BREAKING_CHANGES\n+\tthen\n+\t\ttest_path_is_file .git/TEST_SYMREF_HEAD &&\n+\t\techo \"ref: refs/heads/new\" >expect &&\n+\t\ttest_cmp expect .git/TEST_SYMREF_HEAD &&\n+\t\ttest_must_be_empty err\n+\telse\n+\t\ttest_path_is_symlink .git/TEST_SYMREF_HEAD &&\n+\t\ttest \"$(test_readlink .git/TEST_SYMREF_HEAD)\" = refs/heads/new &&\n+\t\tcat >expect <<-EOF &&\n+\t\twarning: ${SQ}core.preferSymlinkRefs=true${SQ} is nominated for removal.\n+\t\thint: The use of symbolic links for symbolic refs is deprecated\n+\t\thint: and will be removed in Git 3.0. The configuration that\n+\t\thint: tells Git to use them is thus going away. You can unset\n+\t\thint: it with:\n+\t\thint:\n+\t\thint:\tgit config unset core.preferSymlinkRefs\n+\t\thint:\n+\t\thint: Git will then use the symref format instead.\n+\t\tEOF\n+\t\ttest_cmp expect err\n+\tfi\n '\n \n test_expect_success 'symref transaction supports false symlink config' '\n\n---\nbase-commit: 5f9d2e334da76ac55790ce4d4ea971a31bcd57fd\nchange-id: 20251014-pks-ref-files-deprecate-symbolic-links-584597a558b5\n\n"},{"id":"528747","messageId":"xmqqplapxur0.fsf@gitster.g","threadId":"64316","inReplyTo":"20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im","subject":"Re: [PATCH] refs/files: deprecate writing symrefs as symbolic links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-10-14T17:23:31Z","receivedAt":"2025-10-14T17:23:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> +* Support for `core.preferSymlinkRefs=true` has been deprecated and will be\n> +  removed in Git 3.0. If set, symbolic refs like \"HEAD\" would be written as\n> +  symbolic links instead of as a plain file using the symref format.\n\nThe second sentence reads as if we are talking about a newly\nintroduced feature, but I cannot quite rephrase it to avoid that\nimpression myself.\n\n> +Note that for now, only the writing side for such symbolic links is deprecated.\n> +Reading such symbolic links is still supported for now.\n\nDouble \"for now\".  Let's start the above with \"Note that only the ...\".\n\n> diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc\n> index 08739bb9d42..e9272bbc0bd 100644\n> --- a/Documentation/config/core.adoc\n> +++ b/Documentation/config/core.adoc\n> @@ -290,6 +290,9 @@ core.preferSymlinkRefs::\n>  \tand other symbolic reference files, use symbolic links.\n>  \tThis is sometimes needed to work with old scripts that\n>  \texpect HEAD to be a symbolic link.\n> ++\n> +This configuration is deprecated and will be removed in Git 3.0. Writing\n> +symbolic links for symrefs will not be supported anymore.\n\nOr spinning it a bit positively:\n\n\tSymbolic refs will always be written as textual symrefs.\n\n> -#ifdef NO_SYMLINK_HEAD\n> +#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)\n>  #define create_ref_symlink(a, b) (-1)\n\nPerhaps we want to say NOT_CONSTANT(-1) here?\n\n>  #else\n>  static int create_ref_symlink(struct ref_lock *lock, const char *target)\n>  {\n> +\tstatic int warn_once = 1;\n> +\tchar *ref_path;\n>  \tint ret = -1;\n>  \n> -\tchar *ref_path = get_locked_file_path(&lock->lk);\n> +\tif (warn_once)\n> +\t\twarning(_(\"'core.preferSymlinkRefs=true' is nominated for removal.\\n\"\n> +\t\t\t  \"hint: The use of symbolic links for symbolic refs is deprecated\\n\"\n> +\t\t\t  \"hint: and will be removed in Git 3.0. The configuration that\\n\"\n> +\t\t\t  \"hint: tells Git to use them is thus going away. You can unset\\n\"\n> +\t\t\t  \"hint: it with:\\n\"\n> +\t\t\t  \"hint:\\n\"\n> +\t\t\t  \"hint:\\tgit config unset core.preferSymlinkRefs\\n\"\n> +\t\t\t  \"hint:\\n\"\n> +\t\t\t  \"hint: Git will then use the symref format instead.\"));\n\nI've always called them \"textual symref\" when I needed to\ndifferenciate them from symbolic links.  I haven't seen \"symref\nformat\", though.  Do we have an official terminology?\n\n> +\twarn_once = 0;\n> +\n> +\tref_path = get_locked_file_path(&lock->lk);\n\nWas there a reason why we want to first warn and then attempt to\nlock?  We are afraid that we may die before we have a chance to\nwarn()?\n"},{"id":"528779","messageId":"aO84NamCzFXH1eUl@pks.im","threadId":"64316","inReplyTo":"xmqqplapxur0.fsf@gitster.g","subject":"Re: [PATCH] refs/files: deprecate writing symrefs as symbolic links","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-10-15T05:59:17Z","receivedAt":"2025-10-15T05:59:24Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Tue, Oct 14, 2025 at 10:23:31AM -0700, Junio C Hamano wrote:\n> Patrick Steinhardt <ps@pks.im> writes:\n> \n> > +* Support for `core.preferSymlinkRefs=true` has been deprecated and will be\n> > +  removed in Git 3.0. If set, symbolic refs like \"HEAD\" would be written as\n> > +  symbolic links instead of as a plain file using the symref format.\n> \n> The second sentence reads as if we are talking about a newly\n> introduced feature, but I cannot quite rephrase it to avoid that\n> impression myself.\n\nHow about:\n\n  Support for `core.preferSymlinkRefs=true` has been deprecated and will be\n  removed in Git 3.0. Writing symbolic refs as symbolic links will be phased\n  out in favor of using plain files using the textual representation of\n  symbolic refs.\n\n> > +Note that for now, only the writing side for such symbolic links is deprecated.\n> > +Reading such symbolic links is still supported for now.\n> \n> Double \"for now\".  Let's start the above with \"Note that only the ...\".\n\nYup.\n\n> > diff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc\n> > index 08739bb9d42..e9272bbc0bd 100644\n> > --- a/Documentation/config/core.adoc\n> > +++ b/Documentation/config/core.adoc\n> > @@ -290,6 +290,9 @@ core.preferSymlinkRefs::\n> >  \tand other symbolic reference files, use symbolic links.\n> >  \tThis is sometimes needed to work with old scripts that\n> >  \texpect HEAD to be a symbolic link.\n> > ++\n> > +This configuration is deprecated and will be removed in Git 3.0. Writing\n> > +symbolic links for symrefs will not be supported anymore.\n> \n> Or spinning it a bit positively:\n> \n> \tSymbolic refs will always be written as textual symrefs.\n\nOkay.\n\n> > -#ifdef NO_SYMLINK_HEAD\n> > +#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)\n> >  #define create_ref_symlink(a, b) (-1)\n> \n> Perhaps we want to say NOT_CONSTANT(-1) here?\n\nWe do have `NOT_CONSTANT()` at the callsite, as introduced by Johannes.\nI don't really see a reason to change that now.\n\n> >  #else\n> >  static int create_ref_symlink(struct ref_lock *lock, const char *target)\n> >  {\n> > +\tstatic int warn_once = 1;\n> > +\tchar *ref_path;\n> >  \tint ret = -1;\n> >  \n> > -\tchar *ref_path = get_locked_file_path(&lock->lk);\n> > +\tif (warn_once)\n> > +\t\twarning(_(\"'core.preferSymlinkRefs=true' is nominated for removal.\\n\"\n> > +\t\t\t  \"hint: The use of symbolic links for symbolic refs is deprecated\\n\"\n> > +\t\t\t  \"hint: and will be removed in Git 3.0. The configuration that\\n\"\n> > +\t\t\t  \"hint: tells Git to use them is thus going away. You can unset\\n\"\n> > +\t\t\t  \"hint: it with:\\n\"\n> > +\t\t\t  \"hint:\\n\"\n> > +\t\t\t  \"hint:\\tgit config unset core.preferSymlinkRefs\\n\"\n> > +\t\t\t  \"hint:\\n\"\n> > +\t\t\t  \"hint: Git will then use the symref format instead.\"));\n> \n> I've always called them \"textual symref\" when I needed to\n> differenciate them from symbolic links.  I haven't seen \"symref\n> format\", though.  Do we have an official terminology?\n\nI don't think we do. I'll say \"textual symref format\" here.\n\n> > +\twarn_once = 0;\n> > +\n> > +\tref_path = get_locked_file_path(&lock->lk);\n> \n> Was there a reason why we want to first warn and then attempt to\n> lock?  We are afraid that we may die before we have a chance to\n> warn()?\n\nNo particular reason, no. Happy to move it towards the end so that error\nmessages are given preference.\n\nThanks!\n\nPatrick\n"},{"id":"528789","messageId":"20251015-pks-ref-files-deprecate-symbolic-links-v2-1-0529ba48db41@pks.im","threadId":"64316","inReplyTo":"20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im","subject":"[PATCH v2] refs/files: deprecate writing symrefs as symbolic links","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2025-10-15T06:26:08Z","receivedAt":"2025-10-15T06:26:16Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"The \"files\" backend has the ability to store symbolic refs as symbolic\nlinks, which can be configured via \"core.preferSymlinkRefs\". This\nfeature stems back from the early days: the initial implementation of\nsymbolic refs used symlinks exclusively. The symref format was only\nintroduced in 9b143c6e15 (Teach update-ref about a symbolic ref stored\nin a textfile., 2005-09-25) and made the default in 9f0bb90d16\n(core.prefersymlinkrefs: use symlinks for .git/HEAD, 2006-05-02).\n\nThis is all about 20 years ago, and there are no known reasons nowadays\nwhy one would want to use symlinks instead of symrefs. Mark the feature\nfor deprecation in Git 3.0.\n\nNote that this only deprecates _writing_ symrefs as symbolic links.\nReading such symrefs is still supported for now.\n\nSigned-off-by: Patrick Steinhardt <ps@pks.im>\n---\nHi,\n\nas discussed in [1], this small patch deprecates\n\"core.preferSymlinkRefs\". Thanks!\n\nChanges in v2:\n  - Tweaks for the deprecation announcement.\n  - Use \"textual symref format\" instead of \"symref format\".\n  - Warn after having created the symlink so that we don't drown out\n    messages from `die()` that may have happened in\n    `get_locked_file_path()`.\n  - Link to v1: https://lore.kernel.org/r/20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im\n\nPatrick\n\n[1]: <xmqqzf9zddia.fsf@gitster.g>\n---\n Documentation/BreakingChanges.adoc | 20 ++++++++++++++++++++\n Documentation/config/core.adoc     |  3 +++\n refs/files-backend.c               | 19 +++++++++++++++++--\n t/t0600-reffiles-backend.sh        | 26 +++++++++++++++++++++++---\n 4 files changed, 63 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc\nindex 90b53abcea2..f814450d2f6 100644\n--- a/Documentation/BreakingChanges.adoc\n+++ b/Documentation/BreakingChanges.adoc\n@@ -295,6 +295,26 @@ The command will be removed.\n +\n cf. <xmqqa59i45wc.fsf@gitster.g>\n \n+* Support for `core.preferSymlinkRefs=true` has been deprecated and will be\n+  removed in Git 3.0. Writing symbolic refs as symbolic links will be phased\n+  out in favor of using plain files using the textual representation of\n+  symbolic refs.\n++\n+Symbolic references were initially always stored as a symbolic link. This was\n+changed in 9b143c6e15 (Teach update-ref about a symbolic ref stored in a\n+textfile., 2005-09-25), where a new textual symref format was introduced to\n+store those symbolic refs in a plain file. In 9f0bb90d16\n+(core.prefersymlinkrefs: use symlinks for .git/HEAD, 2006-05-02), the Git\n+project switched the default to use the textual symrefs in favor of symbolic\n+links.\n++\n+The migration away from symbolic links has happened almost 20 years ago by now,\n+and there is no known reason why one should prefer them nowadays. Furthermore,\n+symbolic links are not supported on some platforms.\n++\n+Note that only the writing side for such symbolic links is deprecated. Reading\n+such symbolic links is still supported for now.\n+\n == Superseded features that will not be deprecated\n \n Some features have gained newer replacements that aim to improve the design in\ndiff --git a/Documentation/config/core.adoc b/Documentation/config/core.adoc\nindex 08739bb9d42..406d7029d9d 100644\n--- a/Documentation/config/core.adoc\n+++ b/Documentation/config/core.adoc\n@@ -290,6 +290,9 @@ core.preferSymlinkRefs::\n \tand other symbolic reference files, use symbolic links.\n \tThis is sometimes needed to work with old scripts that\n \texpect HEAD to be a symbolic link.\n++\n+This configuration is deprecated and will be removed in Git 3.0. Symbolic refs\n+will always be written as textual symrefs.\n \n core.alternateRefsCommand::\n \tWhen advertising tips of available history from an alternate, use the shell to\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 3e46386531d..6b65e601920 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -2114,20 +2114,35 @@ static int commit_ref_update(struct files_ref_store *refs,\n \treturn 0;\n }\n \n-#ifdef NO_SYMLINK_HEAD\n+#if defined(NO_SYMLINK_HEAD) || defined(WITH_BREAKING_CHANGES)\n #define create_ref_symlink(a, b) (-1)\n #else\n static int create_ref_symlink(struct ref_lock *lock, const char *target)\n {\n+\tstatic int warn_once = 1;\n+\tchar *ref_path;\n \tint ret = -1;\n \n-\tchar *ref_path = get_locked_file_path(&lock->lk);\n+\tref_path = get_locked_file_path(&lock->lk);\n \tunlink(ref_path);\n \tret = symlink(target, ref_path);\n \tfree(ref_path);\n \n \tif (ret)\n \t\tfprintf(stderr, \"no symlink - falling back to symbolic ref\\n\");\n+\n+\tif (warn_once)\n+\t\twarning(_(\"'core.preferSymlinkRefs=true' is nominated for removal.\\n\"\n+\t\t\t  \"hint: The use of symbolic links for symbolic refs is deprecated\\n\"\n+\t\t\t  \"hint: and will be removed in Git 3.0. The configuration that\\n\"\n+\t\t\t  \"hint: tells Git to use them is thus going away. You can unset\\n\"\n+\t\t\t  \"hint: it with:\\n\"\n+\t\t\t  \"hint:\\n\"\n+\t\t\t  \"hint:\\tgit config unset core.preferSymlinkRefs\\n\"\n+\t\t\t  \"hint:\\n\"\n+\t\t\t  \"hint: Git will then use the textual symref format instead.\"));\n+\twarn_once = 0;\n+\n \treturn ret;\n }\n #endif\ndiff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh\nindex 1e62c791d97..b11126ed478 100755\n--- a/t/t0600-reffiles-backend.sh\n+++ b/t/t0600-reffiles-backend.sh\n@@ -477,9 +477,29 @@ test_expect_success SYMLINKS 'symref transaction supports symlinks' '\n \tprepare\n \tcommit\n \tEOF\n-\tgit update-ref --no-deref --stdin <stdin &&\n-\ttest_path_is_symlink .git/TEST_SYMREF_HEAD &&\n-\ttest \"$(test_readlink .git/TEST_SYMREF_HEAD)\" = refs/heads/new\n+\tgit update-ref --no-deref --stdin <stdin 2>err &&\n+\tif test_have_prereq WITH_BREAKING_CHANGES\n+\tthen\n+\t\ttest_path_is_file .git/TEST_SYMREF_HEAD &&\n+\t\techo \"ref: refs/heads/new\" >expect &&\n+\t\ttest_cmp expect .git/TEST_SYMREF_HEAD &&\n+\t\ttest_must_be_empty err\n+\telse\n+\t\ttest_path_is_symlink .git/TEST_SYMREF_HEAD &&\n+\t\ttest \"$(test_readlink .git/TEST_SYMREF_HEAD)\" = refs/heads/new &&\n+\t\tcat >expect <<-EOF &&\n+\t\twarning: ${SQ}core.preferSymlinkRefs=true${SQ} is nominated for removal.\n+\t\thint: The use of symbolic links for symbolic refs is deprecated\n+\t\thint: and will be removed in Git 3.0. The configuration that\n+\t\thint: tells Git to use them is thus going away. You can unset\n+\t\thint: it with:\n+\t\thint:\n+\t\thint:\tgit config unset core.preferSymlinkRefs\n+\t\thint:\n+\t\thint: Git will then use the textual symref format instead.\n+\t\tEOF\n+\t\ttest_cmp expect err\n+\tfi\n '\n \n test_expect_success 'symref transaction supports false symlink config' '\n\n---\nbase-commit: 5f9d2e334da76ac55790ce4d4ea971a31bcd57fd\nchange-id: 20251014-pks-ref-files-deprecate-symbolic-links-584597a558b5\n\n"},{"id":"528818","messageId":"xmqq347kw77a.fsf@gitster.g","threadId":"64316","inReplyTo":"aO84NamCzFXH1eUl@pks.im","subject":"Re: [PATCH] refs/files: deprecate writing symrefs as symbolic links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-10-15T14:49:45Z","receivedAt":"2025-10-15T14:49:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> I don't think we do. I'll say \"textual symref format\" here.\n>\n>> > +\twarn_once = 0;\n>> > +\n>> > +\tref_path = get_locked_file_path(&lock->lk);\n>> \n>> Was there a reason why we want to first warn and then attempt to\n>> lock?  We are afraid that we may die before we have a chance to\n>> warn()?\n>\n> No particular reason, no. Happy to move it towards the end so that error\n> messages are given preference.\n\nI have no strong preference.  I just wondered if there were deep\nreason that was unexplained behind this change.\n"},{"id":"528824","messageId":"xmqqo6q8uoon.fsf@gitster.g","threadId":"64316","inReplyTo":"20251015-pks-ref-files-deprecate-symbolic-links-v2-1-0529ba48db41@pks.im","subject":"Re: [PATCH v2] refs/files: deprecate writing symrefs as symbolic links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-10-15T16:15:04Z","receivedAt":"2025-10-15T16:15:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> The \"files\" backend has the ability to store symbolic refs as symbolic\n> links, which can be configured via \"core.preferSymlinkRefs\". This\n> feature stems back from the early days: the initial implementation of\n> symbolic refs used symlinks exclusively. The symref format was only\n> introduced in 9b143c6e15 (Teach update-ref about a symbolic ref stored\n> in a textfile., 2005-09-25) and made the default in 9f0bb90d16\n> (core.prefersymlinkrefs: use symlinks for .git/HEAD, 2006-05-02).\n>\n> This is all about 20 years ago, and there are no known reasons nowadays\n> why one would want to use symlinks instead of symrefs. Mark the feature\n> for deprecation in Git 3.0.\n>\n> Note that this only deprecates _writing_ symrefs as symbolic links.\n> Reading such symrefs is still supported for now.\n>\n> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n> ---\n> Hi,\n>\n> as discussed in [1], this small patch deprecates\n> \"core.preferSymlinkRefs\". Thanks!\n>\n> Changes in v2:\n>   - Tweaks for the deprecation announcement.\n>   - Use \"textual symref format\" instead of \"symref format\".\n>   - Warn after having created the symlink so that we don't drown out\n>     messages from `die()` that may have happened in\n>     `get_locked_file_path()`.\n>   - Link to v1: https://lore.kernel.org/r/20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im\n\nLooking good.  Will replace.\n\nThanks.\n"},{"id":"529527","messageId":"xmqqy0p1s5jh.fsf@gitster.g","threadId":"64316","inReplyTo":"xmqqo6q8uoon.fsf@gitster.g","subject":"Re: [PATCH v2] refs/files: deprecate writing symrefs as symbolic links","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-10-23T20:54:10Z","receivedAt":"2025-10-23T20:54:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Patrick Steinhardt <ps@pks.im> writes:\n>\n>> The \"files\" backend has the ability to store symbolic refs as symbolic\n>> links, which can be configured via \"core.preferSymlinkRefs\". This\n>> feature stems back from the early days: the initial implementation of\n>> symbolic refs used symlinks exclusively. The symref format was only\n>> introduced in 9b143c6e15 (Teach update-ref about a symbolic ref stored\n>> in a textfile., 2005-09-25) and made the default in 9f0bb90d16\n>> (core.prefersymlinkrefs: use symlinks for .git/HEAD, 2006-05-02).\n>>\n>> This is all about 20 years ago, and there are no known reasons nowadays\n>> why one would want to use symlinks instead of symrefs. Mark the feature\n>> for deprecation in Git 3.0.\n>>\n>> Note that this only deprecates _writing_ symrefs as symbolic links.\n>> Reading such symrefs is still supported for now.\n>>\n>> Signed-off-by: Patrick Steinhardt <ps@pks.im>\n>> ---\n>> Hi,\n>>\n>> as discussed in [1], this small patch deprecates\n>> \"core.preferSymlinkRefs\". Thanks!\n>>\n>> Changes in v2:\n>>   - Tweaks for the deprecation announcement.\n>>   - Use \"textual symref format\" instead of \"symref format\".\n>>   - Warn after having created the symlink so that we don't drown out\n>>     messages from `die()` that may have happened in\n>>     `get_locked_file_path()`.\n>>   - Link to v1: https://lore.kernel.org/r/20251014-pks-ref-files-deprecate-symbolic-links-v1-1-4bcd6a4ef6f5@pks.im\n>\n> Looking good.  Will replace.\n\nLet me mark it for 'next'.\n\nThanks.\n"}]}