'
test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' '
+ test_when_finished "chmod 775 .git" &&
(
chmod a-w .git &&
# make dir1/tracked stat-dirty
# make sure "status" succeeded without writing index out
git diff-files | grep dir1/tracked
)
- status=$?
- chmod 775 .git
- (exit $status)
'
(cd sm && echo > bar && git add bar && git commit -q -m 'Add bar') && git add sm
test_i18ngrep ! "Initial commit" output
'
+test_expect_success '--no-optional-locks prevents index update' '
+ test-tool chmtime =1234567890 .git/index &&
+ git --no-optional-locks status &&
+ test-tool chmtime --get .git/index >out &&
+ grep ^1234567890 out &&
+ git status &&
+ test-tool chmtime --get .git/index >out &&
+ ! grep ^1234567890 out
+'
+
test_done