-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean should not remove .git metadata #574
Comments
@msoulier Can you share your solution please (or point me to the source)? |
clean:
find $(OUTPUTDIR) -mindepth 1 -name '.git*' -prune -o -delete This will also exclude |
@rupert: In my testing, those parameters to |
Ah sorry, I've updated the $ find output
output
output/.git
output/.git/hello
output/.gitignore
output/foo
output/foo/bar
output/hello
$ find output -mindepth 1 -name '.git*' -prune -o -print
output/foo
output/foo/bar
output/hello |
Great. Any idea as to the full command to delete everything but the |
Delete everything except $ find $(OUTPUTDIR) -mindepth 1 -name .git -prune -o -delete Delete everything except $ find $(OUTPUTDIR) -mindepth 1 -name '.git*' -prune -o -delete |
In my testing, those commands do the same as I noted previously: preserves the .git directory itself but nukes everything inside it. |
I wrote the commands for Mac OS X @justinmayer, can you try: $ find $(OUTPUTDIR) -mindepth 1 -name '.git*' -prune -o -print0 | xargs -0 rm -rf $ find output
output
output/.git
output/.git/hello
output/.gitignore
output/foo
output/foo/bar
output/hello
$ make clean
find /Users/rupert/rupertb.com/output -mindepth 1 -name '.git*' -prune -o -print0 | xargs -0 rm -rf
$ find output
output
output/.git
output/.git/hello
output/.gitignore |
I actually did my testing on Mac OS X 10.8.2 to produce the behavior described above. I thought about Honestly, if folks want to avoid nuking |
Instead of the Makefile, I believe that output folder cleaning behavior should, whenever possible, be handled by pelican.util's |
If DELETE_OUTPUT_DIRECTORY is set to True, all files and directories are deleted from the output directory. There are, however, several reasons one might want to retain certain files/directories and avoid their deletion from the output directory. One such use case is version control system data: a versioned output directory can facilitate deployment via Heroku and/or allow the user to easily revert to a prior version of the site without having to rely on regeneration via Pelican. This change introduces the OUTPUT_RETENTION setting, a tuple of filenames that will be preserved when the clean_output_dir function in pelican.utils is run. Setting OUTPUT_RETENTION = (".hg", ".git") would, for example, prevent the relevant VCS data from being deleted when the output directory is cleaned.
I've introduced the |
Keep certain files when cleaning output; fix #574
If DELETE_OUTPUT_DIRECTORY is set to True, all files and directories are deleted from the output directory. There are, however, several reasons one might want to retain certain files/directories and avoid their deletion from the output directory. One such use case is version control system data: a versioned output directory can facilitate deployment via Heroku and/or allow the user to easily revert to a prior version of the site without having to rely on regeneration via Pelican. This change introduces the OUTPUT_RETENTION setting, a tuple of filenames that will be preserved when the clean_output_dir function in pelican.utils is run. Setting OUTPUT_RETENTION = (".hg", ".git") would, for example, prevent the relevant VCS data from being deleted when the output directory is cleaned.
I am deploying my pelican-generated site via heroku, so the target directory is a git repository. make clean deletes everything at the output directory, so I had to hack up my makefile to stop that behaviour.
The text was updated successfully, but these errors were encountered: