mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-04 01:15:41 +02:00
Fix bug in --path-rename argument without colon
The --path-rename flag expected an argument with a colon character (':') in it, which it assumed without checking. If the user gave an argument with no colon in it, this backtrace would be shown: File "/usr/local/bin/git-filter-repo", line 1626, in __call__ if values[0] and values[1] and not ( IndexError: list index out of range Add a real error message in place of the backtrace. Also check that there's exactly one colon; show an error message if there's more than one, as that syntax has no interpretation that is obviously the right one. Signed-off-by: Lassi Kortela <lassi@lassi.io>
This commit is contained in:
parent
407d15dd29
commit
28b479b79d
|
@ -1622,7 +1622,10 @@ class FilteringOptions(object):
|
|||
if suffix.startswith('rename'):
|
||||
mod_type = 'rename'
|
||||
match_type = option_string[len('--path-rename-'):] or 'match'
|
||||
values = values.split(b':', 1)
|
||||
values = values.split(b':')
|
||||
if len(values) != 2:
|
||||
raise SystemExit(_("Error: --path-rename expects one colon in its"
|
||||
" argument: <old_name:new_name>."))
|
||||
if values[0] and values[1] and not (
|
||||
values[0].endswith(b'/') == values[1].endswith(b'/')):
|
||||
raise SystemExit(_("Error: With --path-rename, if OLD_NAME and "
|
||||
|
|
Loading…
Reference in New Issue
Block a user