]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ab/fix-commit-error-message-upon-unwritable-object-store'
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Oct 2021 23:06:57 +0000 (16:06 -0700)
"git commit" gave duplicated error message when the object store
was unwritable, which has been corrected.

* ab/fix-commit-error-message-upon-unwritable-object-store:
  commit: fix duplication regression in permission error output
  unwritable tests: assert exact error output

1  2 
cache.h
object-file.c
object-store.h
t/t0004-unwritable.sh

diff --cc cache.h
Simple merge
diff --cc object-file.c
Simple merge
diff --cc object-store.h
Simple merge
index 37d68ef03be4a468a4926d37f3cfab40f78ac9bb,3bdafbae0f003863b09d01c6ded07c8c1be14e03..2e9d652d826af230fc90166c9ef53da3f6e7aa7e
@@@ -19,13 -18,31 +19,31 @@@ 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
+       test_must_fail git write-tree 2>out.write-tree
+ '
+ test_lazy_prereq WRITE_TREE_OUT 'test -e "$TRASH_DIRECTORY"/out.write-tree'
+ test_expect_success WRITE_TREE_OUT 'write-tree output on unwritable repository' '
+       cat >expect <<-\EOF &&
+       error: insufficient permission for adding an object to repository database .git/objects
+       fatal: git-write-tree: error building trees
+       EOF
+       test_cmp expect out.write-tree
  '
  
 -test_expect_success POSIXPERM,SANITY 'commit should notice unwritable repository' '
 +test_expect_success POSIXPERM,SANITY,!SANITIZE_LEAK '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
+       test_must_fail git commit -m second 2>out.commit
+ '
+ test_lazy_prereq COMMIT_OUT 'test -e "$TRASH_DIRECTORY"/out.commit'
+ test_expect_success COMMIT_OUT 'commit output on unwritable repository' '
+       cat >expect <<-\EOF &&
+       error: insufficient permission for adding an object to repository database .git/objects
+       error: Error building trees
+       EOF
+       test_cmp expect out.commit
  '
  
  test_expect_success POSIXPERM,SANITY 'update-index should notice unwritable repository' '