# bug? 'git log -M100' is different from 'git log -M100%'

3 messages from 2012-12-17 to 2012-12-18. Participants: Sitaram Chamarty, Junio C Hamano.
Thread: https://gitlist.dev/t/32381

## Sitaram Chamarty, 2012-12-17 23:34

Subject: bug? 'git log -M100' is different from 'git log -M100%'
Message-ID: <20121217233446.GA5987@sita-lt.atc.tcs.com>
URL: https://gitlist.dev/e/20121217233446.GA5987%40sita-lt.atc.tcs.com

```
Hi,

When using -M with a number to act as a threshold for declaring
a change as being a rename, I found a... quirk.  Any 2-digit
number after the M will work, but if the number is 100, it will
require a % to be appended to be effective.

Here's a transcript that will demonstrate the problem when run
in an empty directory.

    # setup
    git init
    seq 1 100 > f1
    git add f1
    git commit -m f1
    git rm f1
    ( seq 1 45; seq 1001 1010; seq 56 100 ) > f2
    git add f2
    git commit -m f2

    # here's the buglet

    git log -1 --stat --raw -M
    # this tells you the files are 83% similar

    git log -1 --stat --raw -M82
    # this shows it like a rename

    git log -1 --stat --raw -M83
    # this also

    git log -1 --stat --raw -M84
    # this shows two separate files

    git log -1 --stat --raw -M99
    # this also

    # so far so good...

    git log -1 --stat --raw -M100
    # but this shows it like a rename

    git log -1 --stat --raw -M100%
    # adding a percent sign fixes it, now they're two separate
    # files.  It seems to be required only when you ask for 100%

-- 
Sitaram Chamarty

```

## Junio C Hamano, 2012-12-18 01:25

Subject: Re: bug? 'git log -M100' is different from 'git log -M100%'
Message-ID: <7vfw34jgmv.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfw34jgmv.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20121217233446.GA5987@sita-lt.atc.tcs.com>

```
Sitaram Chamarty <sitaramc@gmail.com> writes:

> When using -M with a number to act as a threshold for declaring
> a change as being a rename, I found a... quirk.  Any 2-digit
> number after the M will work,...

That is not 2-digit number.

A few historical trivia may help.

Originally we said "you can use -M2 to choose 2/10" (like "gzip"
taking compression levels between "-0" to "-9").  Then Linus came up
with a clever idea to let people specify arbitrary precision by
letting you say "-M25" to mean 25/100 and "-M254" to mean 254/1000.

Read the numbers without per-cent as if it has decimal point before
it (i.e. -M005 is talking about 0.005 which is 0.5%).  Full hundred
per-cent has to be spelled with per-cent sign for obvious reasons
with this scheme but that cannot be avoided.  It is a special case.

```

## Sitaram Chamarty, 2012-12-18 04:17

Subject: Re: bug? 'git log -M100' is different from 'git log -M100%'
Message-ID: <CAMK1S_jVuJgmdb47A=SGV7_9uH2SEj-SHYFdSY_7nSuLCNxdkQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMK1S_jVuJgmdb47A%3DSGV7_9uH2SEj-SHYFdSY_7nSuLCNxdkQ%40mail.gmail.com
In-Reply-To: <7vfw34jgmv.fsf@alter.siamese.dyndns.org>

```
On Tue, Dec 18, 2012 at 6:55 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Sitaram Chamarty <sitaramc@gmail.com> writes:
>
>> When using -M with a number to act as a threshold for declaring
>> a change as being a rename, I found a... quirk.  Any 2-digit
>> number after the M will work,...
>
> That is not 2-digit number.
>
> A few historical trivia may help.
>
> Originally we said "you can use -M2 to choose 2/10" (like "gzip"
> taking compression levels between "-0" to "-9").  Then Linus came up
> with a clever idea to let people specify arbitrary precision by
> letting you say "-M25" to mean 25/100 and "-M254" to mean 254/1000.
>
> Read the numbers without per-cent as if it has decimal point before
> it (i.e. -M005 is talking about 0.005 which is 0.5%).  Full hundred
> per-cent has to be spelled with per-cent sign for obvious reasons
> with this scheme but that cannot be avoided.  It is a special case.

Oh nice.  Makes sense; thanks!

I submitted a patch to diff-options.txt (separately).

regards

sitaram

```
