Skip to content
  • Junio C Hamano's avatar
    tests: clean after SANITY tests · 03771425
    Junio C Hamano authored
    
    
    Some of our tests try to make sure Git behaves sensibly in a
    read-only directory, by dropping 'w' permission bit before doing a
    test and then restoring it after it is done.  The latter is needed
    for the test framework to clean after itself without leaving a
    leftover directory that cannot be removed.
    
    Ancient parts of tests however arrange the above with
    
    	chmod a-w . &&
    	... do the test ...
    	status=$?
    	chmod 775 .
    	(exit $status)
    
    which obviously would not work if the test somehow dies before it
    has the chance to do "chmod 775".  Rewrite them by following a more
    robust pattern recently written tests use, which is
    
    	test_when_finished "chmod 775 ." &&
    	chmod a-w . &&
    	... do the test ...
    
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    03771425