git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] unwritable tests: assert exact error output
@ 2021-10-09 13:34 Ævar Arnfjörð Bjarmason
  2021-10-09 13:34 ` [PATCH 2/2] commit: fix duplication regression in permission " Ævar Arnfjörð Bjarmason
  2021-10-11 20:50 ` [PATCH 1/2] unwritable tests: assert exact " Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-10-09 13:34 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, David Turner,
	Ævar Arnfjörð Bjarmason

In preparation for fixing a regression where we started emitting some
of these error messages twice, let's assert what the output from "git
commit" and friends is now in the case of permission errors.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0004-unwritable.sh | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
index e3137d638ee..998c9d1be69 100755
--- a/t/t0004-unwritable.sh
+++ b/t/t0004-unwritable.sh
@@ -18,27 +18,55 @@ test_expect_success setup '
 test_expect_success POSIXPERM,SANITY 'write-tree should notice unwritable repository' '
 	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
 	chmod a-w .git/objects .git/objects/?? &&
-	test_must_fail git write-tree
+
+	cat >expect <<-\EOF &&
+	error: insufficient permission for adding an object to repository database .git/objects
+	fatal: git-write-tree: error building trees
+	EOF
+	test_must_fail git write-tree 2>actual &&
+	test_cmp expect actual
 '
 
 test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
 	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
 	chmod a-w .git/objects .git/objects/?? &&
-	test_must_fail git commit -m second
+
+	cat >expect <<-\EOF &&
+	error: insufficient permission for adding an object to repository database .git/objects
+	error: insufficient permission for adding an object to repository database .git/objects
+	error: Error building trees
+	EOF
+	test_must_fail git commit -m second 2>actual &&
+	test_cmp expect actual
 '
 
 test_expect_success POSIXPERM,SANITY 'update-index should notice unwritable repository' '
 	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
 	echo 6O >file &&
 	chmod a-w .git/objects .git/objects/?? &&
-	test_must_fail git update-index file
+
+	cat >expect <<-\EOF &&
+	error: insufficient permission for adding an object to repository database .git/objects
+	error: file: failed to insert into database
+	fatal: Unable to process path file
+	EOF
+	test_must_fail git update-index file 2>actual &&
+	test_cmp expect actual
 '
 
 test_expect_success POSIXPERM,SANITY 'add should notice unwritable repository' '
 	test_when_finished "chmod 775 .git/objects .git/objects/??" &&
 	echo b >file &&
 	chmod a-w .git/objects .git/objects/?? &&
-	test_must_fail git add file
+
+	cat >expect <<-\EOF &&
+	error: insufficient permission for adding an object to repository database .git/objects
+	error: file: failed to insert into database
+	error: unable to index file '\''file'\''
+	fatal: updating files failed
+	EOF
+	test_must_fail git add file 2>actual &&
+	test_cmp expect actual
 '
 
 test_done
-- 
2.33.0.1492.gcc3b81fc59a


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-12 14:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-09 13:34 [PATCH 1/2] unwritable tests: assert exact error output Ævar Arnfjörð Bjarmason
2021-10-09 13:34 ` [PATCH 2/2] commit: fix duplication regression in permission " Ævar Arnfjörð Bjarmason
2021-10-11 20:56   ` Junio C Hamano
2021-10-12 14:30   ` [PATCH v2 0/2] " Ævar Arnfjörð Bjarmason
2021-10-12 14:30     ` [PATCH v2 1/2] unwritable tests: assert exact " Ævar Arnfjörð Bjarmason
2021-10-12 14:30     ` [PATCH v2 2/2] commit: fix duplication regression in permission " Ævar Arnfjörð Bjarmason
2021-10-11 20:50 ` [PATCH 1/2] unwritable tests: assert exact " Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).