You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The conversion of the output object to the returned dict fails with the message:
Traceback (most recent call last):
File "/usr/bin/git-filter-repo", line 4151, in
main()
File "/usr/bin/git-filter-repo", line 4148, in main
filter.run()
File "/usr/bin/git-filter-repo", line 4068, in run
self._run_sanity_checks()
File "/usr/bin/git-filter-repo", line 2931, in _run_sanity_checks
self._config_settings = GitUtils.get_config_settings(target_working_dir)
File "/usr/bin/git-filter-repo", line 1563, in get_config_settings
return dict(line.split(b'=', maxsplit=1)
ValueError: dictionary update sequence element #2 has length 1; 2 is required
Potential Solution
I fixed the issue by modifying the function as follows:
@staticmethod
def get_config_settings(repo_working_dir):
output = ''
try:
output = subproc.check_output('git config --list'.split(),
cwd=repo_working_dir)
except subprocess.CalledProcessError as e: # pragma: no cover
raise SystemExit('fatal: {}'.format(e))
# Changes start here -->
decoded_output = output.decode('utf-8')
lines = [line for line in decoded_output.split('\n') if line.strip()]
# FIXME: Ignores multi-valued keys, just let them overwrite for now
return dict(line.split('=', maxsplit=1) for line in lines if '=' in line)
There are probably better ways to solve the issue that do not involve an opinionated decoding step, as I cannot tell what side-effects the decoding step may have in repos that are not UTF-8 encoded.
Summary
When running my desired git filter-repo ... command with this function, the command works as intended, and raises no error.
The text was updated successfully, but these errors were encountered:
Issue Description
When running
git filter-repo
, I get an error from theget_config_settings
function.Cause
The output of line 1556's
subproc.check_output(git config --list.split(), cwd=repo_working_dir)
is equivalent to:The conversion of the
output
object to the returneddict
fails with the message:Potential Solution
I fixed the issue by modifying the function as follows:
There are probably better ways to solve the issue that do not involve an opinionated decoding step, as I cannot tell what side-effects the decoding step may have in repos that are not UTF-8 encoded.
Summary
When running my desired
git filter-repo ...
command with this function, the command works as intended, and raises no error.The text was updated successfully, but these errors were encountered: