Create patches with --full-index --binary
PATCH 1/1 Create patches with --full-index --binary
If a patch contains binaries, the git show command b4 currently uses will not generate a patch that can be applied by git. Add --full-index --binary flags to correct this.
---
Commits that change binary blobs are not correctly formatted as patches when using b4 send because by default git show doesn't include binary data. The result is an "cannot apply patch without full index" error from git when fetching patches with b4.
This patch adds the necessary flags to amend this.
--- src/b4/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
src/b4/__init__.py +13 -2
@@ -3424,8 +3424,19 @@ def git_range_to_patches(gitdir: Optional[str], start: str, end: str, if commit in ignore_commits: logger.debug('Ignoring commit %s', commit) continue - ecode, out = git_run_command(gitdir, ['show', '--format=email', '--patch-with-stat', '--encoding=utf-8', - commit], decode=False) + ecode, out = git_run_command( + gitdir, + [ + 'show', + '--format=email', + '--full-index', + '--binary', + '--patch-with-stat', + '--encoding=utf-8', + commit, + ], + decode=False, + ) if ecode > 0: raise RuntimeError(f'Could not get a patch out of {commit}') msg = email.message_from_bytes(out, policy=emlpolicy)
---
base-commit: 99b128995f27cd9aa6fa8adf7588f339919ac14d
change-id: 20240827-fix-binary-patch-91b6bcda8509
Best regards,
Signature · 1 line
γαῖα πυρί μιχθήτω
Konstantin Ryabitsev
AppliedQuoted 5 lines · Manos Pitsidianakis
If a patch contains binaries, the git show command b4 currently uses will not generate a patch that can be applied by git. Add --full-index --binary flags to correct this.
Applied, thanks!
[1/1] Create patches with --full-index --binary
commit: 23a9ddba10a057bfa9c438c0b50ac36d278ae022
Best regards,
Signature · 1 line
Konstantin Ryabitsev <[email protected]>