swh identify --recursive breaks --exclude, resulting in a "AttributeError: 'str' object has no attribute 'decode'" traceback
as per title, here's a test case showing that either options are fine, but they break swh identify
when used //together//:
zack@noziere:~/swh-environment/swh-model$ swh identify .
swh:1:dir:82ee3976a560609a54650073b761080dec03397f .
zack@noziere:~/swh-environment/swh-model$ swh identify -r . | tail -n 1
swh:1:cnt:a5196d1be8fb59edf8062bef36d3a602e0812139 ./.git/info/exclude
zack@noziere:~/swh-environment/swh-model$ swh identify -x foo .
swh:1:dir:82ee3976a560609a54650073b761080dec03397f .
zack@noziere:~/swh-environment/swh-model$ swh identify -x foo -r .
Traceback (most recent call last):
File "/home/zack/.cache/virtualenvs/swh/bin/swh", line 33, in <module>
sys.exit(load_entry_point('swh.core', 'console_scripts', 'swh')())
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-core/swh/core/cli/__init__.py", line 185, in main
return swh(auto_envvar_prefix="SWH")
File "/home/zack/.cache/virtualenvs/swh/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/zack/.cache/virtualenvs/swh/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/zack/.cache/virtualenvs/swh/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/zack/.cache/virtualenvs/swh/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/zack/.cache/virtualenvs/swh/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/cli.py", line 297, in identify
dir_obj = model_of_dir(path, exclude_patterns)
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/cli.py", line 82, in model_of_dir
ignore_directories_patterns(path, exclude_patterns)
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/from_disk.py", line 324, in ignore_directories_patterns
sre_patterns = set(extract_regex_objs(root_path, patterns))
File "/home/zack/dati/projects/sw-heritage/git/swh-environment/swh-model/swh/model/from_disk.py", line 309, in extract_regex_objs
regex = fnmatch.translate((pattern.decode()))
AttributeError: 'str' object has no attribute 'decode'
zack@noziere:~/swh-environment/swh-model$
Migrated from T3383 (view on Phabricator)