#!/bin/sh global test_description := ''detect unwritable repository and fail correctly'' source ./test-lib.sh test_expect_success setup ' >file && git add file && test_tick && git commit -m initial && echo >file && git add file ' 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_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 ' 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 ' 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 ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"detect unwritable repository and fail correctly">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\n"> <"\t>file &&\n"> <"\tgit add file &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m initial &&\n"> <"\techo >file &&\n"> <"\tgit add file\n"> <"\n"> ) } ) (C {(test_expect_success)} {(POSIXPERM) (Lit_Comma ",") (SANITY)} {(SQ <"write-tree should notice unwritable repository">)} { (SQ <"\n"> <"\ttest_when_finished \"chmod 775 .git/objects .git/objects/??\" &&\n"> <"\tchmod a-w .git/objects .git/objects/?? &&\n"> <"\ttest_must_fail git write-tree\n"> ) } ) (C {(test_expect_success)} {(POSIXPERM) (Lit_Comma ",") (SANITY)} {(SQ <"commit should notice unwritable repository">)} { (SQ <"\n"> <"\ttest_when_finished \"chmod 775 .git/objects .git/objects/??\" &&\n"> <"\tchmod a-w .git/objects .git/objects/?? &&\n"> <"\ttest_must_fail git commit -m second\n"> ) } ) (C {(test_expect_success)} {(POSIXPERM) (Lit_Comma ",") (SANITY)} {(SQ <"update-index should notice unwritable repository">)} { (SQ <"\n"> <"\ttest_when_finished \"chmod 775 .git/objects .git/objects/??\" &&\n"> <"\techo 6O >file &&\n"> <"\tchmod a-w .git/objects .git/objects/?? &&\n"> <"\ttest_must_fail git update-index file\n"> ) } ) (C {(test_expect_success)} {(POSIXPERM) (Lit_Comma ",") (SANITY)} {(SQ <"add should notice unwritable repository">)} { (SQ <"\n"> <"\ttest_when_finished \"chmod 775 .git/objects .git/objects/??\" &&\n"> <"\techo b >file &&\n"> <"\tchmod a-w .git/objects .git/objects/?? &&\n"> <"\ttest_must_fail git add file\n"> ) } ) (C {(test_done)}) ] )