Page MenuHomePhabricator

In Git, only use "--find-copies-harder" on small diffs
ClosedPublic

Authored by epriestley on Jul 10 2016, 2:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 12:08 AM
Unknown Object (File)
Mon, Apr 29, 6:14 AM
Unknown Object (File)
Sun, Apr 21, 1:56 PM
Unknown Object (File)
Fri, Apr 19, 5:02 PM
Unknown Object (File)
Fri, Apr 12, 11:05 PM
Unknown Object (File)
Thu, Apr 11, 9:03 AM
Unknown Object (File)
Apr 2 2024, 6:19 AM
Unknown Object (File)
Apr 1 2024, 3:17 AM
Subscribers
None

Details

Summary

Ref T10423. This flag can cause git diff to take an enormously long time (the problem case was a 5M line, 20K file commit).

Instead:

  • Run without the flag first.
  • If that shows that the diff is definitely small, try again with the flag.
  • If that works, return the slower, better output.
  • If the fast diff affects too many paths or generating the slow diff takes too long, return the faster, slightly worse output.

The quality of the output differs in how well Git is able to detect "M" and "C" (moves and copies of files).

For example, if you copy src/ to srcpro/, the fast output may not show that you copied files. The slow output will.

I think this is rarely useful for large copies anyway: it's interesting if a 1-2 file diff is a copy, but usually obvious/uninteresting if a 500-file diff is a copy.

Test Plan
  • Ran bin/repository reparse --change rXnnn on Git changes.
  • Saw fast and slow commands execute normally.
  • Tried on a large diff, saw only the fast command execute.

Diff Detail

Repository
rP Phabricator
Branch
fastcopies
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 13008
Build 16619: Run Core Tests
Build 16618: arc lint + arc unit

Event Timeline

epriestley retitled this revision from to In Git, only use "--find-copies-harder" on small diffs.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Jul 10 2016, 2:40 PM
This revision was automatically updated to reflect the committed changes.