Message ID | 20240827-fix-binary-patch-v1-1-98a3090a69a4@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [b4] Create patches with --full-index --binary | expand |
On Tue, 27 Aug 2024 18:30:17 +0300, Manos Pitsidianakis wrote: > 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,
diff --git a/src/b4/__init__.py b/src/b4/__init__.py index ec230e7ace663516c6bec8cf0ce9fd87f2218d23..e43b836547244c1cffc071067037dbe393ee4042 100644 --- a/src/b4/__init__.py +++ b/src/b4/__init__.py @@ -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)
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. Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> --- 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(-) --- base-commit: 99b128995f27cd9aa6fa8adf7588f339919ac14d change-id: 20240827-fix-binary-patch-91b6bcda8509 Best regards,