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

Re: Git: new feature suggestion

From
Joao Pinto <joao.pinto@synopsys.com>
Date
Jan 18, 2017, 19:04 UTC
Message-ID
<21caed00-d103-5534-156c-0c19f25e0879@synopsys.com>
In-Reply-To
<CAGZ79kYXQcUB+rVkboY9fMqu6R3RoHEJ7BTJn_+-RScFDjEduA@mail.gmail.com>
Hi Stefan,
Às 6:50 PM de 1/18/2017, Stefan Beller escreveu:
Show 75 quoted lines
> On Wed, Jan 18, 2017 at 2:40 AM, Joao Pinto <Joao.Pinto@synopsys.com> wrote:
>> Hello,
>>
>> My name is Joao Pinto, I work at Synopsys and I am a frequent Linux Kernel
>> contributor.
>>
>> Let me start by congratulate you for the fantastic work you have been doing with
>> Git which is an excellent tool.
>>
>> The Linux Kernel as all systems needs to be improved and re-organized to be
>> better prepared for future development and sometimes we need to change
>> folder/files names or even move things around.
>> I have seen a lot of Linux developers avoid this re-organization operations
>> because they would lose the renamed file history, because a new log is created
>> for the new file, even if it is a renamed version of itself.
> 
> Well there are a couple of things to help with digging in the logs.
> 
> git log:
>        --follow
>            Continue listing the history of a file beyond renames (works only
>            for a single file).
> 
>         -M[<n>], --find-renames[=<n>]
>            If generating diffs, detect and report renames for each commit. For
>            following files across renames while traversing history, see
>            --follow. If n is specified, it is a threshold on the similarity
>            index (i.e. amount of addition/deletions compared to the file’s
>            size). For example, -M90% means Git should consider a delete/add
>            pair to be a rename if more than 90% of the file hasn’t changed.
>            Without a % sign, the number is to be read as a fraction, with a
>            decimal point before it. I.e., -M5 becomes 0.5, and is thus the
>            same as -M50%. Similarly, -M05 is the same as -M5%. To limit
>            detection to exact renames, use -M100%. The default similarity
>            index is 50%.
> 
>        -C[<n>], --find-copies[=<n>]
>            Detect copies as well as renames. See also --find-copies-harder. If
>            n is specified, it has the same meaning as for -M<n>.
> 
> 
> 
>> I am sending you this e-mail to suggest the creation of a new feature in Git:
>> when renamed, a file or folder should inherit his parent’s log and a “rename: …”
>> would be automatically created or have some kind of pointer to its “old” form to
>> make history analysis easier.
> 
> How do you currently analyse history, which detailed feature is missing?
> 
> Mind that in the Git data model we deliberately do not record the rename
> at commit time, but rather want to identify the renames at log time.
> This is because
> in the meantime between commit and log viewing someone could have written
> a better rename detection, whereas at commit time we'd be stuck with ancient
> cruft forever. ;)
> 
>>
>> I volunteer to help in the new feature if you find it useful. I think it would
>> improve log history analysis and would enable developers to better organize old
>> code.
> 
> IMHO complete renames (i.e. git mv path/a/file.c path/b/thing.c) are already
> covered quite well. Partial rename (e.g. moving code from one file into two
> separate files or vice versa) is still a bit hard.
> 
> I started such a new feature, see
> https://urldefense.proofpoint.com/v2/url?u=https-3A__public-2Dinbox.org_git_20160903033120.20511-2D1-2Dsbeller-40google.com_&d=DwIFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=BseICq5hy9UHxmX2XP8oPYLbn-HoEUlEuVUzqPHkX58&s=PybtKK0ELH3Nld_CQSYZnLqCQOWvnU4Fjj5iV_7EKqE&e= 
> latest code is at https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_stefanbeller_git_commits_colored-5Fdiff12&d=DwIFaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=s2fO0hii0OGNOv9qQy_HRXy-xAJUD1NNoEcc3io_kx0&m=BseICq5hy9UHxmX2XP8oPYLbn-HoEUlEuVUzqPHkX58&s=pkTehcEmeHVLHdcNbUiU03meyH10cgUbGqLgOqXcL6w&e= ,
> but the latest two commits are bogus and need rewriting.
> 
> I think this feature is not 100% what you are aiming at, but is very close.
> 
> Thanks,
> Stefan
> 
Great info, helps a lot! I am going to analyse and get back to you ASAP.
Thanks
Previous: Stefan BellerNext: Konstantin Khomoutov
Message 3 of 15 in “Git: new feature suggestion”
  1. Joao PintoJan 18, 2017
  2. Stefan BellerJan 18, 2017
  3. Joao PintoJan 18, 2017
  4. Konstantin KhomoutovJan 19, 2017
  5. Junio C HamanoJan 19, 2017
  6. Joao PintoJan 19, 2017
  7. Linus TorvaldsJan 19, 2017
  8. Joao PintoJan 19, 2017
  9. Linus TorvaldsJan 19, 2017
  10. Joao PintoJan 19, 2017
  11. Stefan BellerJan 19, 2017
  12. Joao PintoJan 20, 2017
  13. Jakub NarębskiJan 19, 2017
  14. Linus TorvaldsJan 20, 2017
  15. Jakub NarębskiJan 20, 2017

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.