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

Re: [PATCH 3/3] git-merge-file: refuse to merge binary files

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2007, 05:16 UTC
Message-ID
<7vr6orgeuy.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0706050337010.4046@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 25 quoted lines
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  builtin-merge-file.c  |    6 +++++-
>  t/t6023-merge-file.sh |    5 +++++
>  2 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-merge-file.c b/builtin-merge-file.c
> index 9135773..10ec63b 100644
> --- a/builtin-merge-file.c
> +++ b/builtin-merge-file.c
> @@ -36,9 +36,13 @@ int cmd_merge_file(int argc, char **argv, char **envp)
>  	for (; i < 3; i++)
>  		names[i] = argv[i + 1];
>  
> -	for (i = 0; i < 3; i++)
> +	for (i = 0; i < 3; i++) {
>  		if (read_mmfile(mmfs + i, argv[i + 1]))
>  			return -1;
> +		if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size))
> +			return error("Cannot merge binary files: %s\n",
> +					argv[i + 1]);
> +	}
>  
>  	ret = xdl_merge(mmfs + 1, mmfs + 0, names[0], mmfs + 2, names[2],
>  			&xpp, XDL_MERGE_ZEALOUS, &result);
Oh, my.

I wonder if we can expose ll_merge() from merge-recursive to this part, instead of raw xdl_merge(). That would give you the custom merge driver the user may have specified in .gitattributes.

Previous: Junio C Hamano
Message 5 of 5 in “git-merge-file: refuse to merge binary files”
  1. 3/3 git-merge-file: refuse to merge binary filesJohannes Schindelin, Jun 5, 2007
  2. Linus TorvaldsJun 5, 2007
  3. Johannes SchindelinJun 5, 2007
  4. Junio C HamanoJun 5, 2007
  5. Junio C HamanoJun 5, 2007

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.