Homec4science

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

Authored by epriestley <git@epriestley.com> on Jul 10 2016, 16:19.

Description

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

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.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10423

Differential Revision: https://secure.phabricator.com/D16266

Details

Committed
epriestley <git@epriestley.com>Jul 10 2016, 17:03
Pushed
aubortJan 31 2017, 17:16
Parents
rPHe2d195e03ab0: Fix mobile menu for files in Differential Changesets
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHd44a5fa93374: In Git, only use "--find-copies-harder" on small diffs (authored by epriestley <git@epriestley.com>).Jul 10 2016, 17:03