From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "Felipe Gonçalves Assis" <felipeg.assis@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Custom merge driver with no rename detection
Date: Mon, 15 Feb 2016 09:06:49 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1602150858340.2964@virtualbox> (raw)
In-Reply-To: <CALMa68ovz=VZYkCcUDvEn1d7=xJDx__71caqsPXUFASZ1phfdw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
Hi Felipe,
On Sun, 14 Feb 2016, Felipe Gonçalves Assis wrote:
> Attached is a quick and dirty patch that emulates the effect by
> allowing greater than 100% rename thresholds to mean "no-renames".
It is really hard to comment on attached patches.
First comment: the commit message is awfully empty, and lacks a sign-off.
> /* user says num divided by scale and we say internally that
> * is MAX_SCORE * num / scale.
> */
> - return (int)((num >= scale) ? MAX_SCORE : (MAX_SCORE * num / scale));
> + return (int)(MAX_SCORE * num / scale);
Uh oh. I suspect this opens the door pretty wide for integer overflows. I
could imagine that something like
return (int)(num > scale ? MAX_SCORE + 1 : MAX_SCORE * num / scale);
would work better, but it still would need some careful consideration.
> static int diff_scoreopt_parse(const char *opt)
> diff --git a/diffcore-rename.c b/diffcore-rename.c
> index af1fe08..7cb5a3b 100644
> --- a/diffcore-rename.c
> +++ b/diffcore-rename.c
> @@ -497,7 +497,7 @@ void diffcore_rename(struct diff_options *options)
> register_rename_src(p);
> }
> }
> - if (rename_dst_nr == 0 || rename_src_nr == 0)
> + if (rename_dst_nr == 0 || rename_src_nr == 0 || minimum_score > MAX_SCORE)
This line is too long now.
Ciao,
Johannes
next prev parent reply other threads:[~2016-02-15 8:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 19:51 Custom merge driver with no rename detection Felipe Gonçalves Assis
2016-02-15 5:10 ` Junio C Hamano
2016-02-15 8:06 ` Johannes Schindelin
2016-02-15 9:57 ` Junio C Hamano
2016-02-15 8:06 ` Johannes Schindelin [this message]
2016-02-15 10:42 ` Felipe Gonçalves Assis
2016-02-15 11:03 ` Junio C Hamano
2016-02-16 1:04 ` Felipe Gonçalves Assis
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=alpine.DEB.2.20.1602150858340.2964@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=felipeg.assis@gmail.com \
--cc=git@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).