Skip to content

Commit 35c194d

Browse files
sunshinecogitster
authored andcommitted
t1509: facilitate repeated script invocations
t1509-root-work-tree.sh, which tests behavior of a Git repository located at the root `/` directory, refuses to run if it detects the presence of an existing repository at `/`. This safeguard ensures that it won't clobber a legitimate repository at that location. However, because t1509 does a poor job of cleaning up after itself, it runs afoul of its own safety check on subsequent runs, which makes it painful to run the script repeatedly since each run requires manual cleanup of detritus from the previous run. Address this shortcoming by making t1509 clean up after itself as its last action. This is safe since the script can only make it to this cleanup action if it did not find a legitimate repository at `/` in the first place, so the resources cleaned up here can only have been created by the script itself. Signed-off-by: Eric Sunshine <[email protected]>
1 parent ce153b8 commit 35c194d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

t/t1509-root-work-tree.sh

+5
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,9 @@ test_expect_success 'go to /foo' 'cd /foo'
256256

257257
test_vars 'auto gitdir, root' "/" "" ""
258258

259+
test_expect_success 'cleanup root' '
260+
rm -rf /.git /refs /objects /info /hooks /branches /foo &&
261+
rm -f /HEAD /config /description /expected /ls.expected /me /result
262+
'
263+
259264
test_done

0 commit comments

Comments
 (0)