filter-repo: allow removing .git directories from history

Commit 7cfef09e9b (filter-repo: warn users who try to use invalid path
components, 2019-12-26) attempt to protect against using invalid path
components, but also added a check against a path that has sometimes
been valid in the past and which users might want to be able to remove
from their history.  Relax the check so that users can remove '.git'
directories in subdirectories (or even at the toplevel) from their
history.

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2020-05-16 23:55:02 -07:00
parent db9ac1fffe
commit 4cfc765eb1

View File

@ -1641,7 +1641,7 @@ class FilteringOptions(object):
components = values.split(b'/')
if values.startswith(b'/'):
raise SystemExit(_("Error: Pathnames cannot begin with a '/'"))
for illegal_path in [b'.', b'..', b'.git']:
for illegal_path in [b'.', b'..']:
if illegal_path in components:
raise SystemExit(_("Error: Invalid path component '%s' found in '%s'")
% (decode(illegal_path), decode(user_path)))