Ports Repocopy

Brandon Bergren bdragon at FreeBSD.org
Mon Feb 22 20:47:01 UTC 2021

On Mon, Feb 22, 2021, at 1:45 PM, Cy Schubert wrote:
> When ports switches to GIT, given that there is no GIT equivalent to svn 
> copy will repocopy become a thing of the past? Will we live with this or 
> will there be some kind of procedure ports committers must follow to 
> approximate a repocopy?

Renames and copies in git are inferred, not tracked.

About all you can do to make following stuff easier across a copy is to cp -a and immediately commit, before making any changes, so that it shows up in the index with identical file hashes as what it was copied from.

Following a file's history across a copy is dependent on the settings the person looking at the history is using.

It is not enabled by default because it is an extremely expensive operation -- it is O(n^2) where n is the number of files in the tree, plus even then it only works if the original file was modified in the same commit. Otherwise you have to use --find-copies-harder which is an even more expensive option.

If the commit was done by committing an unmodified version first, you can theoretically use `git log --follow -C100% --find-copies-harder <filename>` which should probably be able to do its work without having to compute similarities on all of the objects. But if you have many files with the same contents, I don't really know what the log will look like past that point. I *think* it will just randomly mix history. I haven't tested it though.

I suppose writing a tool that adds metadata about the copy to a git note or something would be the best way to track this stuff...

  Brandon Bergren
  bdragon at FreeBSD.org

More information about the freebsd-git mailing list