sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
Rugged::Diff#find_similar!
Detects entries in the diff that look like renames or copies (based on the given options) and replaces them with actual rename or copy entries. Additionally, modified files can be broken into add/delete pairs if the amount of changes are above a specific threshold (see +:break_rewrite_threshold+). By default, similarity will be measured without leading whitespace. You you can use the +:dont_ignore_whitespace+ to disable this. The following options can be passed in the +options+ Hash: :rename_threshold :: An integer specifying the similarity to consider a file renamed (default 50). :rename_from_rewrite_threshold :: An integer specifying the similarity of modified to be eligible rename source (default 50). :copy_threshold :: An integer specifying the similarity to consider a file a copy (default 50). :break_rewrite_threshold :: An integer specifying the similarity to split modify into delete/add pair (default 60). :rename_limit :: An integer specifying the maximum amount of similarity sources to examine (a la diff's +-l+ option or the +diff.renameLimit+ config) (default 200). :renames :: If true, looking for renames will be enabled (+--find-renames+). :renames_from_rewrites :: If true, the "old side" of modified files will be considered for renames (+--break-rewrites=N+). :copies :: If true, looking for copies will be enabled (+--find-copies+). :copies_from_unmodified :: If true, unmodified files will be considered as copy sources (+--find-copies-harder+). :break_rewrites :: If true, larger rewrites will be split into delete/add pairs (+--break-rewrites=/M+). :all :: If true, enables all finding features. :ignore_whitespace :: If true, similarity will be measured with all whitespace ignored. :dont_ignore_whitespace :: If true, similarity will be measured without ignoring any whitespace.
Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/rugged-1.7.1/ext/rugged/rugged_diff.c
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Rugged--Diff-find_similar--for-pr
# Commit to gitgit add app/server/ruby/vendor/rugged-1.7.1/ext/rugged/rugged_diff.cgit commit -m "better docs for Rugged::Diff#find_similar!"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Rugged--Diff-find_similar--for-pr
hub pull-request
# Celebrate!