#31283: "collecstatic --clear" could take ignored patterns into consideration
-----------------------------------------------+------------------------
               Reporter:  maticomp             |          Owner:  nobody
                   Type:  New feature          |         Status:  new
              Component:  contrib.staticfiles  |        Version:  master
               Severity:  Normal               |       Keywords:
           Triage Stage:  Unreviewed           |      Has patch:  0
    Needs documentation:  0                    |    Needs tests:  0
Patch needs improvement:  0                    |  Easy pickings:  0
                  UI/UX:  0                    |
-----------------------------------------------+------------------------
 When calling `collectstatic --clear` all files from `STATIC_ROOT` are
 cleared, as per documentation (see #22891), which is understandable.

 However, `collectstatic` has `--ignore PATTERN` option as well as the
 possibility to configure ignored patterns through `StaticFilesConfig` and
 `ignore_patterns` variable. This is a handy feature that by default
 ignores some auxiliary files **['CVS', '.*', '*~']** during collecting
 process.

 The documentation is lax about that, but `--clear` is not taking those
 patterns into account, while I think it could.

 The most obvious scenario I've run into was with a project that had
 `static` folder commited to the repository with `.gitkeep` and/or
 `.gitignore` file inside, to make sure the directory is present, clearly
 visible from the outset in the project tree and accounted for.

 Running `collectstatic --clear` clears all the directory contents,
 including `.gitkeep` that would be matched by **['CVS', '.*', '*~']** if
 pattern ignores were considered during clearing. As a result, Git will
 start treating this directory as untracked one, and missing `.git*` as a
 uncommited changeset.

 Ideally, the `--clear` option would respect `--ignore` and
 `StaticFilesConfig`, hence the feature proposal. Otherwise, the
 documentation could be a bit more verbose that it's not the case.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31283>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.9b33350df44eb9c881ba4d0f9888ce7f%40djangoproject.com.

Reply via email to