All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Han-Wen Nienhuys <hanwenn@gmail.com>,
	Josh Steadmon <steadmon@google.com>,
	Luca Milanesio <luca.milanesio@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 2/2] t0610: execute git-pack-refs(1) with specified umask
Date: Tue, 9 Apr 2024 11:57:32 +0200	[thread overview]
Message-ID: <a3bfea94365138e85cac473a83eb51e821dd0def.1712656576.git.ps@pks.im> (raw)
In-Reply-To: <cover.1712656576.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]

The tests for git-pack-refs(1) with the `core.sharedRepository` config
execute git-pack-refs(1) outside of the shell that has the expected
umask set. This is wrong because we want to test the behaviour of that
command with different umasks. The issue went unnoticed because most
distributions have a default umask of 0022, and we only ever test with
`--shared=true`, which re-adds the group write bit.

Fix the issue by moving git-pack-refs(1) into the umask'd shell and add
a bunch of test cases that exercise behaviour more thoroughly.

Note that we drop the check for whether `core.sharedRepository` was set
to the correct value to make the test setup a bit easier. We should be
able to rely on git-init(1) doing its thing correctly. Furthermore, to
help readability, we convert tests that pass `--shared=true` to instead
pass the equivalent `--shared=group`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t0610-reftable-basics.sh | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index a3269c20e0..8ffecefadc 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -105,8 +105,7 @@ test_expect_reftable_perms () {
 		test_when_finished "rm -rf repo" &&
 		(
 			umask $umask &&
-			git init --shared=$shared repo &&
-			test 1 = "$(git -C repo config core.sharedrepository)"
+			git init --shared=$shared repo
 		) &&
 		test_expect_perms "$expect" repo/.git/reftable/tables.list &&
 		for table in repo/.git/reftable/*.ref
@@ -122,9 +121,9 @@ test_expect_reftable_perms () {
 			umask $umask &&
 			git init --shared=$shared repo &&
 			test_commit -C repo A &&
-			test_line_count = 3 repo/.git/reftable/tables.list
+			test_line_count = 3 repo/.git/reftable/tables.list &&
+			git -C repo pack-refs
 		) &&
-		git -C repo pack-refs &&
 		test_expect_perms "$expect" repo/.git/reftable/tables.list &&
 		for table in repo/.git/reftable/*.ref
 		do
@@ -134,8 +133,17 @@ test_expect_reftable_perms () {
 	'
 }
 
-test_expect_reftable_perms 002 true "-rw-rw-r--"
-test_expect_reftable_perms 022 true "-rw-rw-r--"
+test_expect_reftable_perms 002 umask "-rw-rw-r--"
+test_expect_reftable_perms 022 umask "-rw-r--r--"
+test_expect_reftable_perms 027 umask "-rw-r-----"
+
+test_expect_reftable_perms 002 group "-rw-rw-r--"
+test_expect_reftable_perms 022 group "-rw-rw-r--"
+test_expect_reftable_perms 027 group "-rw-rw----"
+
+test_expect_reftable_perms 002 world "-rw-rw-r--"
+test_expect_reftable_perms 022 world "-rw-rw-r--"
+test_expect_reftable_perms 027 world "-rw-rw-r--"
 
 test_expect_success 'clone: can clone reftable repository' '
 	test_when_finished "rm -rf repo clone" &&
-- 
2.44.GIT


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2024-04-09  9:57 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 13:25 [PATCH 00/12] t: exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 01/12] ci: rename "runs_on_pool" to "distro" Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 02/12] ci: expose distro name in dockerized GitHub jobs Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 03/12] ci: allow skipping sudo on dockerized jobs Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 04/12] ci: drop duplicate package installation for "linux-gcc-default" Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 05/12] ci: convert "install-dependencies.sh" to use "/bin/sh" Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 06/12] ci: merge custom PATH directories Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 07/12] ci: merge scripts which install dependencies Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 08/12] ci: make Perforce binaries executable for all users Patrick Steinhardt
2024-04-05 20:01   ` Josh Steadmon
2024-04-08  5:48     ` Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 09/12] ci: install JGit dependency Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 10/12] t06xx: always execute backend-specific tests Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 11/12] t0610: fix non-portable variable assignment Patrick Steinhardt
2024-04-05  9:14   ` Eric Sunshine
2024-04-05  9:40     ` Patrick Steinhardt
2024-04-05 16:02   ` Junio C Hamano
2024-04-05 16:12     ` [PATCH] CodingGuidelines: quote assigned value with "local" and "export" Junio C Hamano
2024-04-05 16:21       ` Junio C Hamano
2024-04-05 17:48       ` Jeff King
2024-04-05 19:36         ` Junio C Hamano
2024-04-05 23:15           ` Junio C Hamano
2024-04-07  1:23             ` Jeff King
2024-04-05 16:44     ` [PATCH 11/12] t0610: fix non-portable variable assignment Patrick Steinhardt
2024-04-04 13:25 ` [PATCH 12/12] t0612: add tests to exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-04-04 21:40   ` Han-Wen Nienhuys
2024-04-05  9:41     ` Patrick Steinhardt
2024-04-06 13:03       ` Han-Wen Nienhuys
2024-04-06 15:53         ` Patrick Steinhardt
2024-04-08  5:24     ` Patrick Steinhardt
2024-04-04 13:37 ` [PATCH 00/12] t: " Patrick Steinhardt
2024-04-08  6:45 ` [PATCH v2 " Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 02/12] ci: expose distro name in dockerized GitHub jobs Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 03/12] ci: allow skipping sudo on dockerized jobs Patrick Steinhardt
2024-04-10 16:53     ` Toon claes
2024-04-10 17:21       ` Junio C Hamano
2024-04-11  8:55         ` Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 04/12] ci: drop duplicate package installation for "linux-gcc-default" Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 05/12] ci: convert "install-dependencies.sh" to use "/bin/sh" Patrick Steinhardt
2024-04-10 20:46     ` Justin Tobler
2024-04-11  8:55       ` Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 06/12] ci: merge custom PATH directories Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 07/12] ci: merge scripts which install dependencies Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 08/12] ci: make Perforce binaries executable for all users Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 09/12] ci: install JGit dependency Patrick Steinhardt
2024-04-08  6:46   ` [PATCH v2 10/12] t06xx: always execute backend-specific tests Patrick Steinhardt
2024-04-08  6:47   ` [PATCH v2 11/12] t0610: fix non-portable variable assignment Patrick Steinhardt
2024-04-08  6:57     ` Eric Sunshine
2024-04-08  8:56       ` Patrick Steinhardt
2024-04-08  6:47   ` [PATCH v2 12/12] t0612: add tests to exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-04-08  7:10     ` Eric Sunshine
2024-04-08 16:07       ` Junio C Hamano
2024-04-08 16:19         ` Eric Sunshine
2024-04-08 16:29           ` Eric Sunshine
2024-04-08 16:22         ` Patrick Steinhardt
2024-04-08 17:26           ` Jeff King
2024-04-08 21:52             ` Junio C Hamano
2024-04-08 21:51           ` Junio C Hamano
2024-04-10 20:43     ` Justin Tobler
2024-04-11  8:55       ` Patrick Steinhardt
2024-04-08  6:47   ` [PATCH v2 01/12] ci: rename "runs_on_pool" to "distro" Patrick Steinhardt
2024-04-09  2:17   ` [PATCH v2 00/12] t: exercise Git/JGit reftable compatibility Junio C Hamano
2024-04-09  3:43     ` Patrick Steinhardt
2024-04-09  5:34       ` Junio C Hamano
2024-04-09  6:07         ` Patrick Steinhardt
2024-04-09  9:57     ` [PATCH 0/2] t0610: fix umask tests Patrick Steinhardt
2024-04-09  9:57       ` [PATCH 1/2] t0610: make `--shared=` tests reusable Patrick Steinhardt
2024-04-09  9:57       ` Patrick Steinhardt [this message]
2024-04-10 21:49       ` [PATCH 0/2] t0610: fix umask tests Justin Tobler
2024-04-11  9:09 ` [PATCH v3 00/13] t: exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-04-11  9:09   ` [PATCH v3 01/13] ci: rename "runs_on_pool" to "distro" Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 02/13] ci: expose distro name in dockerized GitHub jobs Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 03/13] ci: skip sudo when we are already root Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 04/13] ci: drop duplicate package installation for "linux-gcc-default" Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 05/13] ci: convert "install-dependencies.sh" to use "/bin/sh" Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 06/13] ci: merge custom PATH directories Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 07/13] ci: fix setup of custom path for GitLab CI Patrick Steinhardt
2024-04-11 10:06     ` Eric Sunshine
2024-04-11 10:26       ` Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 08/13] ci: merge scripts which install dependencies Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 09/13] ci: make Perforce binaries executable for all users Patrick Steinhardt
2024-04-11  9:10   ` [PATCH v3 10/13] ci: install JGit dependency Patrick Steinhardt
2024-04-11  9:11   ` [PATCH v3 11/13] t06xx: always execute backend-specific tests Patrick Steinhardt
2024-04-11  9:11   ` [PATCH v3 12/13] t0610: fix non-portable variable assignment Patrick Steinhardt
2024-04-11  9:11   ` [PATCH v3 13/13] t0612: add tests to exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-04-12  4:43 ` [PATCH v4 00/13] t: " Patrick Steinhardt
2024-04-12  4:43   ` [PATCH v4 01/13] ci: rename "runs_on_pool" to "distro" Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 02/13] ci: expose distro name in dockerized GitHub jobs Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 03/13] ci: skip sudo when we are already root Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 04/13] ci: drop duplicate package installation for "linux-gcc-default" Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 05/13] ci: convert "install-dependencies.sh" to use "/bin/sh" Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 06/13] ci: merge custom PATH directories Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 07/13] ci: fix setup of custom path for GitLab CI Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 08/13] ci: merge scripts which install dependencies Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 09/13] ci: make Perforce binaries executable for all users Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 10/13] ci: install JGit dependency Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 11/13] t06xx: always execute backend-specific tests Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 12/13] t0610: fix non-portable variable assignment Patrick Steinhardt
2024-04-12  4:44   ` [PATCH v4 13/13] t0612: add tests to exercise Git/JGit reftable compatibility Patrick Steinhardt
2024-05-03 18:42   ` [PATCH v4 00/13] t: " Justin Tobler
2024-05-03 18:48     ` Patrick Steinhardt
2024-05-03 18:57       ` Patrick Steinhardt
2024-05-03 19:35         ` Justin Tobler
2024-05-03 19:49           ` Patrick Steinhardt
2024-05-04 17:32             ` Justin Tobler
2024-05-06  5:53               ` Patrick Steinhardt

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=a3bfea94365138e85cac473a83eb51e821dd0def.1712656576.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanwenn@gmail.com \
    --cc=luca.milanesio@gmail.com \
    --cc=steadmon@google.com \
    --cc=sunshine@sunshineco.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 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.