attach: when commit has the wrong number: TypeError: memoryview: a bytes-like object is required, not 'str'
When making a mistake in the commit number, attaching fails. For example:
/h/d/d/k/koha-code ❯❯❯ git-bz attach 34833 upstream/master..HEAD ✘ 130
Bug 34833 - "order number" untranslatable when editing estimated delivery date
86b54d3 Bug 34833: Make "order number" in acq modal translatable
91e1d63 MAYBE FOLLOW UP Bug 34257: (follow-up): remove redundant spaces
Attach? [yn] y
Moving to starting point
Adding bug reference 91e1d63 MAYBE FOLLOW UP Bug 34257: (follow-up): remove redundant spaces
Cleaning up back to original state on error
Traceback (most recent call last):
File "/usr/local/bin/git-bz", line 2840, in <module>
do_attach(*args)
File "/usr/local/bin/git-bz", line 2168, in do_attach
add_url(bug, commits)
File "/usr/local/bin/git-bz", line 1719, in add_url
add_url_to_head_commit(commit, bug)
File "/usr/local/bin/git-bz", line 1682, in add_url_to_head_commit
git.commit(file="-", amend=True, _input=input)
File "/usr/local/bin/git-bz", line 197, in f
o = git_run(command, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/bin/git-bz", line 167, in git_run
output, error = process.communicate(input)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 1209, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 2088, in _communicate
input_view = memoryview(self._input)
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: memoryview: a bytes-like object is required, not 'str'
When I fix the number in the second commit, it's not bothered by the commit starting with "MAYBE FOLLOW UP" (same error if I have a totally standard name) but it somehow cares about the number being the right one.
Anyway, it took some time to find it was the bug number of a commit being wrong.
Thanks @WNickC for already getting it and mentioning in the chat ^^" https://ilbot3.kohaaloha.com/koha/2023-08-09#i_2378301