Skip to content

Commit b2f6fd9

Browse files
marcowsgitster
authored andcommitted
t7508: add a test for "git status" in a read-only repository
Signed-off-by: Markus Heidelberg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4bb6644 commit b2f6fd9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t7508-status.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,4 +703,19 @@ test_expect_success 'commit --dry-run submodule summary (--amend)' '
703703
test_cmp expect output
704704
'
705705

706+
test_expect_success POSIXPERM 'status succeeds in a read-only repository' '
707+
(
708+
chmod a-w .git &&
709+
# make dir1/tracked stat-dirty
710+
>dir1/tracked1 && mv -f dir1/tracked1 dir1/tracked &&
711+
git status -s >output &&
712+
! grep dir1/tracked output &&
713+
# make sure "status" succeeded without writing index out
714+
git diff-files | grep dir1/tracked
715+
)
716+
status=$?
717+
chmod 775 .git
718+
(exit $status)
719+
'
720+
706721
test_done

0 commit comments

Comments
 (0)