git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-p4: format-patch to diff-tree change breaks binary patches

From
Junio C Hamano <gitster@pobox.com>
Date
May 7, 2014, 17:27 UTC
Message-ID
<xmqqtx91bitp.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140507054854.GA3571@olive>
Tolga Ceylan <tolga.ceylan@gmail.com> writes:
Show 13 quoted lines
> When applying binary patches a full index is required. format-patch
> already handles this, but diff-tree needs '--full-index' argument
> to always output full index. When git-p4 runs git-apply to test
> the patch, git-apply rejects the patch due to abbreviated blob
> object names. This is the error message git-apply emits in this
> case:
>
> error: cannot apply binary patch to '<filename>' without full index line
> error: <filename>: patch does not apply
>
> Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com>
> Acked-by: Pete Wyckoff <pw@padd.com>
> ---

Because the original breakage was already in 1.9, not a regression between 1.9 and master, as the matter of principle our default is to defer until 2.0 final to avoid risking unintended additional breakages elsewhere. But this fix is an obviously correct and trivial single liner that were eyeballed by more than one person, and that affects only three calls to os.system(), and its correctness can be seen even without knowing p4 at all by somebody like me ;-)

So let's queue it for 2.0.
Thanks.
Show 16 quoted lines
>  git-p4.py |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index cdfa2df..4ee6739 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -1311,7 +1311,7 @@ class P4Submit(Command, P4UserMap):
>              else:
>                  die("unknown modifier %s for %s" % (modifier, path))
>  
> -        diffcmd = "git diff-tree -p \"%s\"" % (id)
> +        diffcmd = "git diff-tree --full-index -p \"%s\"" % (id)
>          patchcmd = diffcmd + " | git apply "
>          tryPatchCmd = patchcmd + "--check -"
>          applyPatchCmd = patchcmd + "--check --apply -"
Previous: Tolga Ceylan
Message 2 of 2 in “git-p4: format-patch to diff-tree change breaks binary patches”
  1. git-p4: format-patch to diff-tree change breaks binary patchesTolga Ceylan, May 7, 2014
  2. Junio C HamanoMay 7, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.