git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] t0610: execute git-pack-refs(1) with specified umask

From
Patrick Steinhardt <ps@pks.im>
Date
Apr 9, 2024, 09:57 UTC
Message-ID
<a3bfea94365138e85cac473a83eb51e821dd0def.1712656576.git.ps@pks.im>
In-Reply-To
<cover.1712656576.git.ps@pks.im>

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
Previous: Patrick SteinhardtNext: Justin Tobler
Message 68 of 106 in “t: exercise Git/JGit reftable compatibility”
  1. 00/12 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 4, 2024
  2. 01/12 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 4, 2024
  3. 02/12 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 4, 2024
  4. 03/12 ci: allow skipping sudo on dockerized jobsPatrick Steinhardt, Apr 4, 2024
  5. 04/12 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 4, 2024
  6. 05/12 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 4, 2024
  7. 06/12 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 4, 2024
  8. 07/12 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 4, 2024
  9. 08/12 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 4, 2024
  10. Josh SteadmonApr 5, 2024
  11. Patrick SteinhardtApr 8, 2024
  12. 09/12 ci: install JGit dependencyPatrick Steinhardt, Apr 4, 2024
  13. 10/12 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 4, 2024
  14. 11/12 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 4, 2024
  15. Eric SunshineApr 5, 2024
  16. Patrick SteinhardtApr 5, 2024
  17. Junio C HamanoApr 5, 2024
  18. CodingGuidelines: quote assigned value with "local" and "export"Junio C Hamano, Apr 5, 2024
  19. Junio C HamanoApr 5, 2024
  20. Jeff KingApr 5, 2024
  21. Junio C HamanoApr 5, 2024
  22. Junio C HamanoApr 5, 2024
  23. Jeff KingApr 7, 2024
  24. Patrick SteinhardtApr 5, 2024
  25. 12/12 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 4, 2024
  26. Han-Wen NienhuysApr 4, 2024
  27. Patrick SteinhardtApr 5, 2024
  28. Han-Wen NienhuysApr 6, 2024
  29. Patrick SteinhardtApr 6, 2024
  30. Patrick SteinhardtApr 8, 2024
  31. Patrick SteinhardtApr 4, 2024
  32. 00/12 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 8, 2024
  33. 02/12 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 8, 2024
  34. 03/12 ci: allow skipping sudo on dockerized jobsPatrick Steinhardt, Apr 8, 2024
  35. Toon claesApr 10, 2024
  36. Junio C HamanoApr 10, 2024
  37. Patrick SteinhardtApr 11, 2024
  38. 04/12 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 8, 2024
  39. 05/12 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 8, 2024
  40. Justin ToblerApr 10, 2024
  41. Patrick SteinhardtApr 11, 2024
  42. 06/12 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 8, 2024
  43. 07/12 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 8, 2024
  44. 08/12 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 8, 2024
  45. 09/12 ci: install JGit dependencyPatrick Steinhardt, Apr 8, 2024
  46. 10/12 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 8, 2024
  47. 11/12 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 8, 2024
  48. Eric SunshineApr 8, 2024
  49. Patrick SteinhardtApr 8, 2024
  50. 12/12 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 8, 2024
  51. Eric SunshineApr 8, 2024
  52. Junio C HamanoApr 8, 2024
  53. Eric SunshineApr 8, 2024
  54. Eric SunshineApr 8, 2024
  55. Patrick SteinhardtApr 8, 2024
  56. Jeff KingApr 8, 2024
  57. Junio C HamanoApr 8, 2024
  58. Junio C HamanoApr 8, 2024
  59. Justin ToblerApr 10, 2024
  60. Patrick SteinhardtApr 11, 2024
  61. 01/12 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 8, 2024
  62. Junio C HamanoApr 9, 2024
  63. Patrick SteinhardtApr 9, 2024
  64. Junio C HamanoApr 9, 2024
  65. Patrick SteinhardtApr 9, 2024
  66. 0/2 t0610: fix umask testsPatrick Steinhardt, Apr 9, 2024
  67. 1/2 t0610: make `--shared=` tests reusablePatrick Steinhardt, Apr 9, 2024
  68. 2/2 t0610: execute git-pack-refs(1) with specified umaskPatrick Steinhardt, Apr 9, 2024
  69. Justin ToblerApr 10, 2024
  70. 00/13 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 11, 2024
  71. 01/13 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 11, 2024
  72. 02/13 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 11, 2024
  73. 03/13 ci: skip sudo when we are already rootPatrick Steinhardt, Apr 11, 2024
  74. 04/13 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 11, 2024
  75. 05/13 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 11, 2024
  76. 06/13 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 11, 2024
  77. 07/13 ci: fix setup of custom path for GitLab CIPatrick Steinhardt, Apr 11, 2024
  78. Eric SunshineApr 11, 2024
  79. Patrick SteinhardtApr 11, 2024
  80. 08/13 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 11, 2024
  81. 09/13 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 11, 2024
  82. 10/13 ci: install JGit dependencyPatrick Steinhardt, Apr 11, 2024
  83. 11/13 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 11, 2024
  84. 12/13 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 11, 2024
  85. 13/13 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 11, 2024
  86. 00/13 t: exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 12, 2024
  87. 01/13 ci: rename "runs_on_pool" to "distro"Patrick Steinhardt, Apr 12, 2024
  88. 02/13 ci: expose distro name in dockerized GitHub jobsPatrick Steinhardt, Apr 12, 2024
  89. 03/13 ci: skip sudo when we are already rootPatrick Steinhardt, Apr 12, 2024
  90. 04/13 ci: drop duplicate package installation for "linux-gcc-default"Patrick Steinhardt, Apr 12, 2024
  91. 05/13 ci: convert "install-dependencies.sh" to use "/bin/sh"Patrick Steinhardt, Apr 12, 2024
  92. 06/13 ci: merge custom PATH directoriesPatrick Steinhardt, Apr 12, 2024
  93. 07/13 ci: fix setup of custom path for GitLab CIPatrick Steinhardt, Apr 12, 2024
  94. 08/13 ci: merge scripts which install dependenciesPatrick Steinhardt, Apr 12, 2024
  95. 09/13 ci: make Perforce binaries executable for all usersPatrick Steinhardt, Apr 12, 2024
  96. 10/13 ci: install JGit dependencyPatrick Steinhardt, Apr 12, 2024
  97. 11/13 t06xx: always execute backend-specific testsPatrick Steinhardt, Apr 12, 2024
  98. 12/13 t0610: fix non-portable variable assignmentPatrick Steinhardt, Apr 12, 2024
  99. 13/13 t0612: add tests to exercise Git/JGit reftable compatibilityPatrick Steinhardt, Apr 12, 2024
  100. Justin ToblerMay 3, 2024
  101. Patrick SteinhardtMay 3, 2024
  102. Patrick SteinhardtMay 3, 2024
  103. Justin ToblerMay 3, 2024
  104. Patrick SteinhardtMay 3, 2024
  105. Justin ToblerMay 4, 2024
  106. Patrick SteinhardtMay 6, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.