NEW DATE! Bugzilla will undergo maintenance 2024-03-28 18h00 CET. Bugzilla will be placed in read-only mode at that time.

Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 371725 - Support binary patches
Summary: Support binary patches
Status: REOPENED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 1.3   Edit
Hardware: PC Windows XP
: P3 enhancement with 4 votes (vote)
Target Milestone: 5.12   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 06:13 EST by Szymon Ptaszkiewicz CLA
Modified: 2021-05-26 08:31 EDT (History)
6 users (show)

See Also:


Attachments
Git patch file containing the fix (44.91 KB, patch)
2016-02-03 10:44 EST, Yuriy Rotmistrov CLA
no flags Details | Diff
This patch has license fixed (17.12 KB, patch)
2016-02-04 05:53 EST, Yuriy Rotmistrov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Ptaszkiewicz CLA 2012-02-16 06:13:02 EST
Eclipse EGit	1.3.0.201202130524

Currently, when creating a patch with binary file, the patch contains only "Binary files differ" line. It would be nice if creating and applying binary
patches would be supported.
Comment 1 Markus Keller CLA 2013-08-20 15:12:10 EDT
I almost lost data due to this. The wizard must at least warn the user that the patch is going to be incomplete.
Comment 2 Ricky Veach CLA 2014-12-04 07:00:39 EST
This is still an issue in at least version 3.41.

I have a history item with a doc file, and create patch only shows "Binary files differ" where the diff display would normally be, regardless of the patch format.
Comment 3 Yuriy Rotmistrov CLA 2016-02-03 10:44:03 EST
Created attachment 259537 [details]
Git patch file containing the fix

Added support for binary patches in JGit.
JUnit test is included.
Several minor fixes were also made to properly handle non ASCII characters (like UTF-8) in text patches.

Note that the patch attached to this bug as a fix has binary content used in the JUnit test. Therefore this patch should be applied with native git (because JGit/EGit does not understand binary patch content till this fix is applied :).
Comment 4 Matthias Sohn CLA 2016-02-03 19:36:58 EST
could you please push your fix to Gerrit for code review following
https://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
Comment 5 Matthias Sohn CLA 2016-02-03 19:43:31 EST
JGit is licensed under EDL (Eclipse Distribution License), we can only accept contributions under that license. 

The license header in each source file must match the following template (see any source file in JGit):

/*
 * Copyright (C) <year>, <company or individual>
 * and other copyright owners as documented in the project's IP log.
 *
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Distribution License v1.0 which
 * accompanies this distribution, is reproduced below, and is
 * available at http://www.eclipse.org/org/documents/edl-v10.php
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or
 * without modification, are permitted provided that the following
 * conditions are met:
 *
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * - Redistributions in binary form must reproduce the above
 *   copyright notice, this list of conditions and the following
 *   disclaimer in the documentation and/or other materials provided
 *   with the distribution.
 *
 * - Neither the name of the Eclipse Foundation, Inc. nor the
 *   names of its contributors may be used to endorse or promote
 *   products derived from this software without specific prior
 *   written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
Comment 6 Yuriy Rotmistrov CLA 2016-02-04 05:53:27 EST
Created attachment 259562 [details]
This patch has license fixed

This patch should be applied after the first one, it has license agreements fixed.
Comment 7 Eclipse Genie CLA 2016-02-04 10:19:31 EST
New Gerrit change created: https://git.eclipse.org/r/65902
Comment 8 Eclipse Genie CLA 2016-02-04 10:19:33 EST
New Gerrit change created: https://git.eclipse.org/r/65901
Comment 9 Eclipse Genie CLA 2021-03-11 10:09:38 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/177592
Comment 10 Eclipse Genie CLA 2021-03-11 10:09:41 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/177593
Comment 11 Eclipse Genie CLA 2021-03-11 10:09:44 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/177594
Comment 12 Eclipse Genie CLA 2021-03-11 10:09:47 EST
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/177595
Comment 13 Thomas Wolf CLA 2021-03-11 10:24:14 EST
Yuriy's change from 2016 is abandoned, but even it were not, it could not be taken:

* it's not license clean; the Base85 codec is a direct copy/translation of the C git code and is thus GPL2 licensed and must not be included in JGit.
* it's tainted by unrelated changes to encoding problems that are better handled via bug 571585 and via https://git.eclipse.org/r/c/jgit/jgit/+/177596 .

There is yet another attempt at this (also from 2016 and also abandoned, by Nadav Cohen) in https://git.eclipse.org/r/c/jgit/jgit/+/78350 , but that only handles literal binary patches, not delta patches, and does everything in memory.

This new series is a fresh attempt at all this.
Comment 18 Thomas Wolf CLA 2021-05-26 08:31:17 EDT
Sorry, not fixed in EGit yet. Missing bits:

* Creating binary patches
* Checking that applying them via EGit UI works.