t7508: add a test for "git status" in a read-only repository
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Markus Heidelberg committed
Apr 3, 2010 at 12:11 UTC
b2f6fd95756de395bd8df77a4069e45b534eab26
1 file changed
+15
t/t7508-status.sh
+15
@@ -703,4 +703,19 @@ test_expect_success 'commit --dry-run submodule summary (--amend)' '
703
test_cmp expect output
704
'
705
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
+
721
test_done