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

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

From
Sitaram Chamarty <sitaramc@gmail.com>
Date
Dec 17, 2012, 23:34 UTC
Message-ID
<20121217233446.GA5987@sita-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
Next: Junio C Hamano
Message 1 of 3 in “bug? 'git log -M100' is different from 'git log -M100%'”
  1. Sitaram ChamartyDec 17, 2012
  2. Junio C HamanoDec 18, 2012
  3. Sitaram ChamartyDec 18, 2012

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.