All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Clemens Buchacher <drizzd@aon.at>
Cc: git@vger.kernel.org, Marat Radchenko <marat@slonopotamus.org>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] hash binary sha1 into patch id
Date: Fri, 13 Aug 2010 15:00:31 -0500	[thread overview]
Message-ID: <20100813200031.GD2003@burratino> (raw)
In-Reply-To: <20100813094027.GA20906@localhost>

Clemens Buchacher wrote:

> Since commit 2f82f760 (Take binary diffs into account for "git rebase"), binary
> files are included in patch ID computation. Binary files are diffed using the
> text diff algorithm, however
[...]
> Instead of hashing the diff of binary files, use the post-image sha1, which is
> just as unique. As a result, performance is much improved.

Maybe it should use both the pre- and post-image?

> diff --git a/diff.c b/diff.c
> index 17873f3..20fc6db 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3758,6 +3758,12 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
>  					len2, p->two->path);
>  		git_SHA1_Update(&ctx, buffer, len1);
>  
> +		if (diff_filespec_is_binary(p->two)) {
> +			len1 = sprintf(buffer, "%s", sha1_to_hex(p->two->sha1));
> +			git_SHA1_Update(&ctx, buffer, len1);


i.e., maybe also

			git_SHA1_Update(&ctx, sha1_to_hex(p->one->sha1), 40);

Luckily this is after the filenames and so on have been incorporated,
so there’s no need to add that specially.

  reply	other threads:[~2010-08-13 20:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13  9:40 [PATCH] hash binary sha1 into patch id Clemens Buchacher
2010-08-13 20:00 ` Jonathan Nieder [this message]
2010-08-13 21:23   ` Clemens Buchacher
2010-08-13 21:37     ` Jonathan Nieder
2010-08-13 21:58       ` Clemens Buchacher
2010-08-15  7:20         ` [PATCH v2] " Clemens Buchacher
2010-08-15  7:56           ` Jonathan Nieder
2010-09-10  5:17           ` Marat Radchenko
2010-09-10  8:16             ` Clemens Buchacher
2010-10-13  7:46               ` Marat Radchenko
2010-10-13  9:17                 ` Marat Radchenko
2010-10-13 21:10                   ` Clemens Buchacher
2010-10-14  7:19                     ` Marat Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100813200031.GD2003@burratino \
    --to=jrnieder@gmail.com \
    --cc=drizzd@aon.at \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=marat@slonopotamus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.