From 72c099100503fc7b41c8cd1412e655e821066b6a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 30 Apr 2015 18:17:17 -0400 Subject: [PATCH] Don't delete *.pyc fils in the .git directory If you have a branch named "remove-all-.pyc", the original code would clobber it inside the .git directory, because branches become files with the same name. This prevents find from looking in .git, saving your precious oddly named branches. --- pavelib/utils/test/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pavelib/utils/test/utils.py b/pavelib/utils/test/utils.py index 19413345fe..ab9aa5f55c 100644 --- a/pavelib/utils/test/utils.py +++ b/pavelib/utils/test/utils.py @@ -18,7 +18,7 @@ def clean_test_files(): Clean fixture files used by tests and .pyc files """ sh("git clean -fqdx test_root/logs test_root/data test_root/staticfiles test_root/uploads") - sh("find . -type f -name \"*.pyc\" -delete") + sh("find . -type f -name \"*.pyc\" -not -path './.git/*' -delete") sh("rm -rf test_root/log/auto_screenshots/*") sh("rm -rf /tmp/mako_[cl]ms")