From patchwork Wed Sep 18 23:28:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13807256 Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81ABD18A6B6 for ; Wed, 18 Sep 2024 23:28:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702112; cv=none; b=GEotzZYUos15TcFhDjjZAnrpyQQJ0484fgyIvRegfqh0itv0Lok2c1u6wVqoLkDPOWhGOv/ZLSjlCIvNRv3Ty2PsoYEUJ6Zj5sdL/iSiahKM7f7DsNSbH1Hr1K/G0z0swzvigDqU85Z1QfTf4NheRD9zgpnRf+3Y9MamOsIPGLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702112; c=relaxed/simple; bh=LVideiFPaqno3t4JANQTixbR/iHU49Xsdvqpyfr2lBE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CyS8y+uCr6Vz5w1ndJTlZVh2rEggiWNKKEq1DwdZFGXpWrw6mbgixrLM+JWszn9EWYBOpicqoqQ0AzxohBpizrECwCsQnYnGoSQJUJT8wRNPzHyjM3rIAmDwSMk694x9sbINbIklcxnUQb4vlnLniu/Gil94/JJNHrn89cwMzgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=dv8rR6Un; arc=none smtp.client-ip=64.147.108.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="dv8rR6Un" Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 5D4481B714; Wed, 18 Sep 2024 19:28:29 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=LVideiFPaqno3t4JANQTixbR/ iHU49Xsdvqpyfr2lBE=; b=dv8rR6UnR9DsWK8+ZdT1A++SG908hJKmzV9zU49lN EjyYl493RQS6+tVrvU0VKwC2T5M7fPbVhITo7H1iQa+O/aJosXxcKO/thrUsxlGM F7TzrIhpcDZXSYD1g2tPqDduqTY8AmWf84z8Sar4KTrh9a+I5nCQlYPlnqIYkSRN kU= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 548DA1B713; Wed, 18 Sep 2024 19:28:29 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [34.125.108.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id B22001B712; Wed, 18 Sep 2024 19:28:28 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 1/4] refs: deprecate core.preferSymlinkRefs Date: Wed, 18 Sep 2024 16:28:22 -0700 Message-ID: <20240918232825.2627999-2-gitster@pobox.com> X-Mailer: git-send-email 2.46.1-742-g4240f61078 In-Reply-To: <20240918232825.2627999-1-gitster@pobox.com> References: <20240918232825.2627999-1-gitster@pobox.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Pobox-Relay-ID: B5C041F8-7615-11EF-B694-9B0F950A682E-77302942!pb-smtp2.pobox.com This step is for immediate consumption. Symbolic links, e.g. .git/HEAD or .git/refs/remotes/origin/HEAD, have been used to represent a symref since very early versions of Git, and they can still be created if the core.preferSymlinkRefs configuration variable tells us to. They however have two downsides: - Obviously, a filesystem that does not support a symbolic link cannot use the feature. For this reason alone, we have long flipped the default to use textual symref, i.e., a regular file with a format that Git recognises. - Except for HEAD and anything at the root level of the refname hierarchy, following a symbolic link that represents the symref would not lead to the referent ref. For example, in order to express that we consider 'main' branch to be the primary among our tracking branches for the 'origin' remote, we would have a symbolic ref .git/refs/remotes/origin/HEAD but the result of calling readlink(2) on the symbolic link is not 'main', nor "$(pwd)/.git/refs/remotes/origin/main". It is relative to the $GIT_DIR, i.e., "refs/remotes/origin/master". This is highly counter-intuitive. Let's decide and declare to remove the support to create such symbolic links at the Git 3.0 version boundary, and in preparation for the move, start warning when somebody _creates_ a symbolic link to represent a new symref. If a third-party tool still expects that HEAD is nothing but a symbolic link, either its authors have got end-user complaints since we made the textual symrefs the default in mid 2006, or nobody is using such a tool so breaking them does not matter. It would not be a problem in practice if Git would never create a symbolic link to represent a symbolic ref. We do not plan to deprecate (or remove) the support to use existing symbolic links at this point, though. As to the implementation: - We give a warning only where the configuration set to true is actually affecting the behaviour of Git, since the behaviour the user is getting today will change with the planned removal. A configuration set to true will not cause a warning, unless you create a symref (e.g., by switching a branch). - The clean-up procedure of the existing tests did not account for the fact that "git symbolic -d REF" on an non-existing REF to fail, which was corrected, together with use of @ where HEAD is more descriptive and perfectly understandable. Signed-off-by: Junio C Hamano --- Documentation/BreakingChanges.txt | 11 +++++++++++ Documentation/config/core.txt | 9 ++++----- refs/files-backend.c | 2 ++ t/t0600-reffiles-backend.sh | 18 ++++++++++-------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Documentation/BreakingChanges.txt b/Documentation/BreakingChanges.txt index 2b64665694..57c002dd0d 100644 --- a/Documentation/BreakingChanges.txt +++ b/Documentation/BreakingChanges.txt @@ -135,6 +135,17 @@ Cf. , , <20230323204047.GA9290@coredump.intra.peff.net>, +* Support for the `core.preferSymlinkRefs` configuration variable + will be removed. ++ + ** The configuration would obviously not work on a filesystem + where symbolic links are not supported. + ** The contents of such a symbolic link used as a symref does + not match end-user intuition unless it is `HEAD`. ++ +The support to treat existing symbolic links under the +`$GIT_DIR/refs/` directory as symrefs is not going away. + == Superseded features that will not be deprecated Some features have gained newer replacements that aim to improve the design in diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 60ca9f2b68..f0245f5050 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -285,11 +285,10 @@ CIFS/Microsoft Windows. + False by default. -core.preferSymlinkRefs:: - Instead of the default "symref" format for HEAD - 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. +core.preferSymlinkRefs (deprecated):: + Instead of the default "symref" format for HEAD and other + symbolic reference files, use symbolic links. The support + for this variable will be dropped in Git 3.0. core.alternateRefsCommand:: When advertising tips of available history from an alternate, use the shell to diff --git a/refs/files-backend.c b/refs/files-backend.c index c7f3f4e591..c40a248b9f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2025,6 +2025,8 @@ static int create_ref_symlink(struct ref_lock *lock, const char *target) if (ret) fprintf(stderr, "no symlink - falling back to symbolic ref\n"); + else + warning("core.preferSymlinkRefs will be removed in Git 3.0"); return ret; } #endif diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 20df336cc3..d369330562 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -469,8 +469,8 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' ' ' test_expect_success SYMLINKS 'symref transaction supports symlinks' ' - test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD" && - git update-ref refs/heads/new @ && + test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && + git update-ref refs/heads/new HEAD && test_config core.prefersymlinkrefs true && cat >stdin <<-EOF && start @@ -478,14 +478,15 @@ test_expect_success SYMLINKS 'symref transaction supports symlinks' ' prepare commit EOF - git update-ref --no-deref --stdin stderr && test_path_is_symlink .git/TEST_SYMREF_HEAD && - test "$(test_readlink .git/TEST_SYMREF_HEAD)" = refs/heads/new + test "$(test_readlink .git/TEST_SYMREF_HEAD)" = refs/heads/new && + test_grep "core\.preferSymlinkRefs will be removed" stderr ' test_expect_success 'symref transaction supports false symlink config' ' - test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD" && - git update-ref refs/heads/new @ && + test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && + git update-ref refs/heads/new HEAD && test_config core.prefersymlinkrefs false && cat >stdin <<-EOF && start @@ -493,11 +494,12 @@ test_expect_success 'symref transaction supports false symlink config' ' prepare commit EOF - git update-ref --no-deref --stdin stderr && test_path_is_file .git/TEST_SYMREF_HEAD && git symbolic-ref TEST_SYMREF_HEAD >actual && echo refs/heads/new >expect && - test_cmp expect actual + test_cmp expect actual && + test_grep ! "core\.preferSymlinkRefs will be removed" stderr ' test_done From patchwork Wed Sep 18 23:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13807257 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4808F1CBE85 for ; Wed, 18 Sep 2024 23:28:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702113; cv=none; b=M/jAeL6W8denayHq/NGcdv2eEVkoG0Xw9+NMtYmzLCI+/OhNPOoVnhT8pC10n4i8QzD7RD/3fmm9BUo14OVYit8a2YBh/w1F6p7mMykyb/ye2QxoaHqQnLpPqfJadVDFAtqK0QXppeNXlC6JjzF8jH/d+LOVLXpGIKoP9xroels= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702113; c=relaxed/simple; bh=CWpFLgGEwHrbd8pmUYSC/H62S63WCPyizP8eDf3aTe8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a2KzDgf2wi5hx+Lt6z0AfYl+/o/G14zMI+y9ntHAW/roSIgPKJczIwIwGKXC/g+Yj4nzH3wcKfG5gi0yAo7N9ziETcCO8bzKVsVfMsoh9bXLMr9SVMMs+DNzp2hjjKxr2hOw22V4UPyT1DttQvvPjARszhsMqhAOstl02s/l5l0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=nvMBtj9P; arc=none smtp.client-ip=64.147.108.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="nvMBtj9P" Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 2170B3549E; Wed, 18 Sep 2024 19:28:31 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=CWpFLgGEwHrbd8pmUYSC/H62S 63WCPyizP8eDf3aTe8=; b=nvMBtj9PtX7I/N8mQeh6Kc0LeCIC71oSLEyw9dewU 8BUTbg0HLUREDfUKjUTADBrBapUPgxgQuSD+ryxgO7r9Av/p3IASC6L36xkTseSU 3PLD1Em4DuXaC4yxHHe7YCNuD/xtDzcxHqtWTX4zrhJxSCRQ9zcnFQ2M9toxYWjy 0g= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 177193549D; Wed, 18 Sep 2024 19:28:31 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [34.125.108.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 464813549C; Wed, 18 Sep 2024 19:28:30 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 2/4] refs: mostly remove core.preferSymlinkRefs Date: Wed, 18 Sep 2024 16:28:23 -0700 Message-ID: <20240918232825.2627999-3-gitster@pobox.com> X-Mailer: git-send-email 2.46.1-742-g4240f61078 In-Reply-To: <20240918232825.2627999-1-gitster@pobox.com> References: <20240918232825.2627999-1-gitster@pobox.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Pobox-Relay-ID: B6ADEDF4-7615-11EF-8BB8-2BAEEB2EC81B-77302942!pb-smtp1.pobox.com This step and the next step are for Git 3.0. Now we are preparing for a big Git 3.0 transition after warning against use of this configuration variable to create a new symlink that represents a symbolic ref for N months, it is time to actually remove the support of the configuration variable. In this patch, we mostly ignore core.preferSymlinkRefs and always create a textual symref when we are asked to create a symref, but when core.preferSymlinkRefs would have caused us to use a symbolic link in an older version of Git, we will issue a warning. We also have in our build infrastructure to selectively set the CPP macro NO_SYMLINK_HEAD, but an accompanying patch will remove them. The final warning is meant to help users who set the configuration variable and expected it to create a symlink, but instead got a textual symref. They may not even recognise the configuration after they set it long time ago and forgot about it by now, so we keep the "git config --help" entry for the variable to help them recall what it was about. After a few releases, we will get rid of this warning and the codebase will look as if such a configuration variable never existed, but we are not quite there yet. Signed-off-by: Junio C Hamano --- Documentation/config/core.txt | 4 ++-- refs/files-backend.c | 29 +++--------------------- t/t0600-reffiles-backend.sh | 42 +++++++++++++++++++++++------------ 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index f0245f5050..a6f67cab27 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -285,10 +285,10 @@ CIFS/Microsoft Windows. + False by default. -core.preferSymlinkRefs (deprecated):: +core.preferSymlinkRefs (removed):: Instead of the default "symref" format for HEAD and other symbolic reference files, use symbolic links. The support - for this variable will be dropped in Git 3.0. + for this variable was dropped in Git 3.0. core.alternateRefsCommand:: When advertising tips of available history from an alternate, use the shell to diff --git a/refs/files-backend.c b/refs/files-backend.c index c40a248b9f..1296272252 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2011,26 +2011,6 @@ static int commit_ref_update(struct files_ref_store *refs, return 0; } -#ifdef NO_SYMLINK_HEAD -#define create_ref_symlink(a, b) (-1) -#else -static int create_ref_symlink(struct ref_lock *lock, const char *target) -{ - int ret = -1; - - char *ref_path = get_locked_file_path(&lock->lk); - unlink(ref_path); - ret = symlink(target, ref_path); - free(ref_path); - - if (ret) - fprintf(stderr, "no symlink - falling back to symbolic ref\n"); - else - warning("core.preferSymlinkRefs will be removed in Git 3.0"); - return ret; -} -#endif - static int create_symref_lock(struct ref_lock *lock, const char *target, struct strbuf *err) { @@ -3003,13 +2983,10 @@ static int files_transaction_finish(struct ref_store *ref_store, } } - /* - * We try creating a symlink, if that succeeds we continue to the - * next update. If not, we try and create a regular symref. - */ + /* Warn against core.preferSymlinkRefs set to true */ if (update->new_target && prefer_symlink_refs) - if (!create_ref_symlink(lock, update->new_target)) - continue; + /* we used to, but no longer, create a symlink here */ + warning("core.preferSymlinkRefs was removed in Git 3.0"); if (update->flags & REF_NEEDS_COMMIT) { clear_loose_ref_cache(refs); diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index d369330562..4e517cdc13 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -468,26 +468,40 @@ test_expect_success POSIXPERM 'git reflog expire honors core.sharedRepository' ' esac ' -test_expect_success SYMLINKS 'symref transaction supports symlinks' ' +test_expect_success SYMLINKS 'symlinks used as symrefs are still supported' ' test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && git update-ref refs/heads/new HEAD && - test_config core.prefersymlinkrefs true && - cat >stdin <<-EOF && - start - symref-create TEST_SYMREF_HEAD refs/heads/new - prepare - commit - EOF - git update-ref --no-deref --stdin stderr && + # manually do this, as core.prefersymlinkrefs no longer + # affects how a symref is created (as a textual symref). + ln -f -s refs/heads/new .git/TEST_SYMREF_HEAD && test_path_is_symlink .git/TEST_SYMREF_HEAD && - test "$(test_readlink .git/TEST_SYMREF_HEAD)" = refs/heads/new && - test_grep "core\.preferSymlinkRefs will be removed" stderr + echo refs/heads/new >expect && + git symbolic-ref TEST_SYMREF_HEAD >actual && + test_cmp actual expect +' + +test_expect_success 'core.prefersymlinkrefs gets a warning' ' + test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && + git update-ref refs/heads/new HEAD && + + test_config core.prefersymlinkrefs true && + git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && + test_grep "core\.preferSymlinkRefs was removed" stderr && + + git symbolic-ref -d TEST_SYMREF_HEAD && + git config core.prefersymlinkrefs false && + git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && + test_grep ! "core\.preferSymlinkRefs was removed" stderr && + + git symbolic-ref -d TEST_SYMREF_HEAD && + git config --unset core.prefersymlinkrefs && + git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && + test_grep ! "core\.preferSymlinkRefs was removed" stderr ' -test_expect_success 'symref transaction supports false symlink config' ' +test_expect_success 'symref transaction' ' test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && git update-ref refs/heads/new HEAD && - test_config core.prefersymlinkrefs false && cat >stdin <<-EOF && start symref-create TEST_SYMREF_HEAD refs/heads/new @@ -499,7 +513,7 @@ test_expect_success 'symref transaction supports false symlink config' ' git symbolic-ref TEST_SYMREF_HEAD >actual && echo refs/heads/new >expect && test_cmp expect actual && - test_grep ! "core\.preferSymlinkRefs will be removed" stderr + test_grep ! "core\.preferSymlinkRefs was removed" stderr ' test_done From patchwork Wed Sep 18 23:28:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13807258 Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 911241CBE98 for ; Wed, 18 Sep 2024 23:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702115; cv=none; b=Mxe49VZElWCwIXZs41yiY2MhEYN14yBKdelwNmk92RxQH3jV1GydQEJHo5CLbqiZnV3Kgd/OaaGLDQQIJ8mC0dHseOINdVAM5jdGbjGBdVAyO1Bxib4B72g7IBlMccm9KFkgrseo8gGoLSjNyYaukENo+tdLbW/ldxmDCzuJ0fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702115; c=relaxed/simple; bh=IuiQrjuk49fmsLjm6s6HxYX6aIbauH9jdYLW2RCl7sQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=djlyNpsbxXlE8L/NMlgAW1z3G6uXgFyGZJfeRCVRSMxPg9YblKuePdB+EAwbsRyBNBGoKkL9elX0hI1oaBCKTlMx5Y9cq6Lc8XKzl4DeJGHmuA0WvFUOvg8lTu6KkxbXtRQbpb5UfKR8B40uFpRfznctuXnREAdDYslbdcWPplY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=L37aAjkl; arc=none smtp.client-ip=64.147.108.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="L37aAjkl" Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 631901B717; Wed, 18 Sep 2024 19:28:32 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=IuiQrjuk49fmsLjm6s6HxYX6a IbauH9jdYLW2RCl7sQ=; b=L37aAjkl+YNadclEnImka13CmSla+N2r3LU1BkGWh mSXKXp/jyvUmZlMcYy9guYDImjSgvuCzU5CYZh0N1W6kGZPtPdJ8eaPwxPIjrtor Cb6aZzigTgdRCVgJJfSXQNxFFN1yHSv+OZmev12JeJfkqzf2TYyLw72aZvqcXupJ oY= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 5BC781B716; Wed, 18 Sep 2024 19:28:32 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [34.125.108.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id C08211B715; Wed, 18 Sep 2024 19:28:31 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 3/4] refs: remove NO_SYMLINK_HEAD Date: Wed, 18 Sep 2024 16:28:24 -0700 Message-ID: <20240918232825.2627999-4-gitster@pobox.com> X-Mailer: git-send-email 2.46.1-742-g4240f61078 In-Reply-To: <20240918232825.2627999-1-gitster@pobox.com> References: <20240918232825.2627999-1-gitster@pobox.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Pobox-Relay-ID: B792D2E8-7615-11EF-AA75-9B0F950A682E-77302942!pb-smtp2.pobox.com This step is for Git 3.0. Remove the build-time setting NO_SYMLINK_HEAD that is used to override the end-user supplied core.preferSymlinkRefs and force use of textual symrefs, as core.preferSymlinkRefs is now gone and we use textual symrefs only. Signed-off-by: Junio C Hamano --- Makefile | 6 ------ config.mak.uname | 3 --- configure.ac | 3 --- contrib/buildsystems/CMakeLists.txt | 2 +- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 275a5ee3c9..029a468702 100644 --- a/Makefile +++ b/Makefile @@ -81,9 +81,6 @@ include shared.mak # # Define NO_SYS_SELECT_H if you don't have sys/select.h. # -# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. -# Enable it on Windows. By default, symrefs are still used. -# # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability # tests. These tests take up a significant amount of the total test time # but are not needed unless you plan to talk to SVN repos. @@ -1767,9 +1764,6 @@ ifdef OPEN_RETURNS_EINTR COMPAT_CFLAGS += -DOPEN_RETURNS_EINTR COMPAT_OBJS += compat/open.o endif -ifdef NO_SYMLINK_HEAD - BASIC_CFLAGS += -DNO_SYMLINK_HEAD -endif ifdef NO_GETTEXT BASIC_CFLAGS += -DNO_GETTEXT USE_GETTEXT_SCHEME ?= fallthrough diff --git a/config.mak.uname b/config.mak.uname index d5112168a4..a38b152312 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -238,7 +238,6 @@ ifeq ($(uname_O),Cygwin) NO_D_TYPE_IN_DIRENT = YesPlease NO_STRCASESTR = YesPlease NO_MEMMEM = YesPlease - NO_SYMLINK_HEAD = YesPlease NO_IPV6 = YesPlease OLD_ICONV = UnfortunatelyYes # There are conflicting reports about this. @@ -446,7 +445,6 @@ ifeq ($(uname_S),Windows) NEEDS_CRYPTO_WITH_SSL = YesPlease NO_LIBGEN_H = YesPlease NO_POLL = YesPlease - NO_SYMLINK_HEAD = YesPlease NO_IPV6 = YesPlease NO_SETENV = YesPlease NO_STRCASESTR = YesPlease @@ -661,7 +659,6 @@ ifeq ($(uname_S),MINGW) NEEDS_CRYPTO_WITH_SSL = YesPlease NO_LIBGEN_H = YesPlease NO_POLL = YesPlease - NO_SYMLINK_HEAD = YesPlease NO_SETENV = YesPlease NO_STRCASESTR = YesPlease NO_STRLCPY = YesPlease diff --git a/configure.ac b/configure.ac index d1a96da14e..307349f323 100644 --- a/configure.ac +++ b/configure.ac @@ -1195,9 +1195,6 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC], GIT_CONF_SUBST([HAVE_BSD_SYSCTL]) ## Other checks. -# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. -# Enable it on Windows. By default, symrefs are still used. -# # Define NO_PTHREADS if we do not have pthreads. # # Define PTHREAD_LIBS to the linker flag used for Pthread support. diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 832f46b316..d6bce22d34 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -267,7 +267,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif() include_directories(${CMAKE_SOURCE_DIR}/compat/win32) add_compile_definitions(HAVE_ALLOCA_H NO_POSIX_GOODIES NATIVE_CRLF NO_UNIX_SOCKETS WIN32 - _CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe" NO_SYMLINK_HEAD UNRELIABLE_FSTAT + _CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe" UNRELIABLE_FSTAT NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0 USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM) From patchwork Wed Sep 18 23:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13807259 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F20D71CBEA6 for ; Wed, 18 Sep 2024 23:28:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.108.70 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702116; cv=none; b=XOT1EaiJ/yZRAyn9mBLUG2RCsVNuKjcyoZcxl3BfZ1p49LCFkTvEzNX0woxItkqoOxL0SfX8tWM9fkDsVj302d7AWnQSDFtOBSRH56L9efwwqWyPOzXDt2LLs/aGbA9nOdUWrEr4/ov9wma6O+aGSw5qL+BAKd18ZvEEynYgUio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726702116; c=relaxed/simple; bh=IcWJqzdNCuAVV1ubr0fLfLkONXw37nYvbq7OhPIXWOw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KQL7SR/iqky94651ZFUHQdgJwcfjaPX6pYF1Hzyh7BFHOhWzSkUu/z/puWUjjEiMhJ1dC2KYRAMDBClRb6z02bgIPiX8NpswlVhKF+d31J65OiM7AKbW8vjG+sOcUmIP+Iue7e0BSgxHWUGwWi5cV62W4PAgJwL0LTMAxLrylLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b=doGTWpVF; arc=none smtp.client-ip=64.147.108.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pobox.com header.i=@pobox.com header.b="doGTWpVF" Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id D4578354A2; Wed, 18 Sep 2024 19:28:33 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=IcWJqzdNCuAVV1ubr0fLfLkON Xw37nYvbq7OhPIXWOw=; b=doGTWpVFZWZZiPp3Eofed0O3wY/pS5c4s4FWpgugl JcztZrWrLI/k36VVyadQfY6TnKPZClgz4MP/QFIU7GPEgJHug6HQhpibH+89fHra SMPMOD3z3K56EOhgnliO3JiJa23qfh+p41J7gVI4toMk6jWKTDFrCdcvdpHptJ38 f8= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id CC892354A1; Wed, 18 Sep 2024 19:28:33 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [34.125.108.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 452473549F; Wed, 18 Sep 2024 19:28:33 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 4/4] refs: remove the last remnants of core.preferSymlinkRefs Date: Wed, 18 Sep 2024 16:28:25 -0700 Message-ID: <20240918232825.2627999-5-gitster@pobox.com> X-Mailer: git-send-email 2.46.1-742-g4240f61078 In-Reply-To: <20240918232825.2627999-1-gitster@pobox.com> References: <20240918232825.2627999-1-gitster@pobox.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Pobox-Relay-ID: B876DF2E-7615-11EF-9332-2BAEEB2EC81B-77302942!pb-smtp1.pobox.com This step is for some time after Git 3.0. Now it is almost N years since we removed the support for the variable at Git 3.0 boundary, it is time to remove the warning about this ancient variable and the behaviour change we went through with it. This concludes the journey to make sure we no longer create a symbolic link to represent a symref, while still recognising existing ones. Signed-off-by: Junio C Hamano --- Documentation/config/core.txt | 5 ----- config.c | 5 ----- environment.c | 1 - environment.h | 1 - refs/files-backend.c | 5 ----- t/t0600-reffiles-backend.sh | 15 ++------------- 6 files changed, 2 insertions(+), 30 deletions(-) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index a6f67cab27..1887da78e3 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -285,11 +285,6 @@ CIFS/Microsoft Windows. + False by default. -core.preferSymlinkRefs (removed):: - Instead of the default "symref" format for HEAD and other - symbolic reference files, use symbolic links. The support - for this variable was dropped in Git 3.0. - core.alternateRefsCommand:: When advertising tips of available history from an alternate, use the shell to execute the specified command instead of linkgit:git-for-each-ref[1]. The diff --git a/config.c b/config.c index 56b5862e59..8693cd510d 100644 --- a/config.c +++ b/config.c @@ -1445,11 +1445,6 @@ static int git_default_core_config(const char *var, const char *value, return 0; } - if (!strcmp(var, "core.prefersymlinkrefs")) { - prefer_symlink_refs = git_config_bool(var, value); - return 0; - } - if (!strcmp(var, "core.logallrefupdates")) { if (value && !strcasecmp(value, "always")) log_all_ref_updates = LOG_REFS_ALWAYS; diff --git a/environment.c b/environment.c index 1d6c48b52d..2c3a60149b 100644 --- a/environment.c +++ b/environment.c @@ -40,7 +40,6 @@ int has_symlinks = 1; int minimum_abbrev = 4, default_abbrev = -1; int ignore_case; int assume_unchanged; -int prefer_symlink_refs; int is_bare_repository_cfg = -1; /* unspecified */ int warn_ambiguous_refs = 1; int warn_on_object_refname_ambiguity = 1; diff --git a/environment.h b/environment.h index 0148738ed6..6b595bd210 100644 --- a/environment.h +++ b/environment.h @@ -127,7 +127,6 @@ extern int has_symlinks; extern int minimum_abbrev, default_abbrev; extern int ignore_case; extern int assume_unchanged; -extern int prefer_symlink_refs; extern int warn_ambiguous_refs; extern int warn_on_object_refname_ambiguity; extern char *apply_default_whitespace; diff --git a/refs/files-backend.c b/refs/files-backend.c index 1296272252..eef01fee06 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2983,11 +2983,6 @@ static int files_transaction_finish(struct ref_store *ref_store, } } - /* Warn against core.preferSymlinkRefs set to true */ - if (update->new_target && prefer_symlink_refs) - /* we used to, but no longer, create a symlink here */ - warning("core.preferSymlinkRefs was removed in Git 3.0"); - if (update->flags & REF_NEEDS_COMMIT) { clear_loose_ref_cache(refs); if (commit_ref(lock)) { diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index 4e517cdc13..4db86757ac 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -480,22 +480,12 @@ test_expect_success SYMLINKS 'symlinks used as symrefs are still supported' ' test_cmp actual expect ' -test_expect_success 'core.prefersymlinkrefs gets a warning' ' +test_expect_success 'core.prefersymlinkrefs no longer gets a warning' ' test_when_finished "git symbolic-ref -d TEST_SYMREF_HEAD || :" && git update-ref refs/heads/new HEAD && test_config core.prefersymlinkrefs true && git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && - test_grep "core\.preferSymlinkRefs was removed" stderr && - - git symbolic-ref -d TEST_SYMREF_HEAD && - git config core.prefersymlinkrefs false && - git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && - test_grep ! "core\.preferSymlinkRefs was removed" stderr && - - git symbolic-ref -d TEST_SYMREF_HEAD && - git config --unset core.prefersymlinkrefs && - git symbolic-ref TEST_SYMREF_HEAD refs/heads/new 2>stderr && test_grep ! "core\.preferSymlinkRefs was removed" stderr ' @@ -512,8 +502,7 @@ test_expect_success 'symref transaction' ' test_path_is_file .git/TEST_SYMREF_HEAD && git symbolic-ref TEST_SYMREF_HEAD >actual && echo refs/heads/new >expect && - test_cmp expect actual && - test_grep ! "core\.preferSymlinkRefs was removed" stderr + test_cmp expect actual ' test_done