GitPython icon indicating copy to clipboard operation
GitPython copied to clipboard

`invalid literal for int() with base 10: 'x'` when diffing commits

Open bobeatslollipop opened this issue 3 years ago • 2 comments

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/cmd.py", line 114, in pump_stream
    handler(line)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/diff.py", line 570, in <lambda>
    handle_process_output(proc, lambda byt: cls._handle_diff_line(byt, repo, index),
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/diff.py", line 557, in _handle_diff_line
python-BaseException
    diff = Diff(repo, a_path, b_path, a_blob_id, b_blob_id, old_mode, new_mode,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/diff.py", line 303, in __init__
    self.a_mode = mode_str_to_int(a_mode) if a_mode else None
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/objects/util.py", line 80, in mode_str_to_int
    mode += int(char) << iteration * 3
ValueError: invalid literal for int() with base 10: 'x'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/git/cmd.py", line 120, in pump_stream
    raise CommandError([f'<{name}-pump>'] + remove_password_if_present(cmdline), ex) from ex
git.exc.CommandError: Cmd('<stdout-pump>') failed due to: ValueError('invalid literal for int() with base 10: 'x'')
  cmdline: <stdout-pump> git diff-tree 81a1f0c4f84aeb6ee97edea64251419515eff571 8c38dfe86157463d745c453d9a1d8c066cc9b7c5 -r --abbrev=40 --full-index -M --raw -z --no-color

This is my first time posting an issue, so please tell me what extra information is needed!

bobeatslollipop avatar Aug 25 '22 03:08 bobeatslollipop

It couldn't parse the output of this command:

git diff-tree 81a1f0c4f84aeb6ee97edea64251419515eff571 8c38dfe86157463d745c453d9a1d8c066cc9b7c5 -r --abbrev=40 --full-index -M --raw -z --no-color

If executed by hand, it should yield the output which ideally is posted here. That way it should become clear why it tries to parse x as integer.

Byron avatar Aug 26 '22 00:08 Byron

This was fixed by #1491.

langfield avatar Sep 14 '22 00:09 langfield