From 45f92f73deba667236e1cf160630e3167a326722 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 10 Nov 2016 10:55:11 -0500 Subject: [PATCH] A perhaps too-baroque way to clean files but also keep some. --- .gitignore | 4 ++++ Makefile | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 4be2989f47..a1d2c4c1f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,13 @@ ### Files private to developers +# Files that should be git-ignored, but are hand-edited or otherwise valued, +# and so should not be destroyed by "make clean". +# start-noclean requirements/private.txt lms/envs/private.py cms/envs/private.py +# end-noclean ### Python artifacts *.pyc diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..98679b661a --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +# Do things in edx-platform + +clean: + # Remove all the git-ignored stuff, but save and restore things marked + # by start-noclean/end-noclean. + sed -n -e '/start-noclean/,/end-noclean/p' < .gitignore > /tmp/private-files + tar cf /tmp/private.tar `git ls-files --exclude-from=/tmp/private-files --ignored --others` + git clean -fdX + tar xf /tmp/private.tar