sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
Rugged::Tree.diff
Returns a diff between the `tree` and the diffable object that was given. +diffable+ can either be a +Rugged::Commit+, a +Rugged::Tree+, a +Rugged::Index+, or +nil+. The +tree+ object will be used as the "old file" side of the diff, while the parent tree or the +diffable+ object will be used for the "new file" side. If +tree+ or +diffable+ are nil, they will be treated as an empty tree. Passing both as `nil` will raise an exception. The following options can be passed in the +options+ Hash: :paths :: An array of paths / fnmatch patterns to constrain the diff to a specific set of files. Also see +:disable_pathspec_match+. :max_size :: An integer specifying the maximum byte size of a file before a it will be treated as binary. The default value is 512MB. :context_lines :: The number of unchanged lines that define the boundary of a hunk (and to display before and after the actual changes). The default is 3. :interhunk_lines :: The maximum number of unchanged lines between hunk boundaries before the hunks will be merged into a one. The default is 0. :old_prefix :: The virtual "directory" to prefix to old filenames in hunk headers. The default is "a". :new_prefix :: The virtual "directory" to prefix to new filenames in hunk headers. The default is "b". :reverse :: If true, the sides of the diff will be reversed. :force_text :: If true, all files will be treated as text, disabling binary attributes & detection. :ignore_whitespace :: If true, all whitespace will be ignored. :ignore_whitespace_change :: If true, changes in amount of whitespace will be ignored. :ignore_whitespace_eol :: If true, whitespace at end of line will be ignored. :ignore_submodules :: if true, submodules will be excluded from the diff completely. :patience :: If true, the "patience diff" algorithm will be used (currenlty unimplemented). :include_ignored :: If true, ignored files will be included in the diff. :include_untracked :: If true, untracked files will be included in the diff. :include_unmodified :: If true, unmodified files will be included in the diff. :recurse_untracked_dirs :: Even if +:include_untracked+ is true, untracked directories will only be marked with a single entry in the diff. If this flag is set to true, all files under ignored directories will be included in the diff, too. :disable_pathspec_match :: If true, the given +:paths+ will be applied as exact matches, instead of as fnmatch patterns. :deltas_are_icase :: If true, filename comparisons will be made with case-insensitivity. :include_untracked_content :: if true, untracked content will be contained in the the diff patch text. :skip_binary_check :: If true, diff deltas will be generated without spending time on binary detection. This is useful to improve performance in cases where the actual file content difference is not needed. :include_typechange :: If true, type changes for files will not be interpreted as deletion of the "old file" and addition of the "new file", but will generate typechange records. :include_typechange_trees :: Even if +:include_typechange+ is true, blob -> tree changes will still usually be handled as a deletion of the blob. If this flag is set to true, blob -> tree changes will be marked as typechanges. :ignore_filemode :: If true, file mode changes will be ignored. :recurse_ignored_dirs :: Even if +:include_ignored+ is true, ignored directories will only be marked with a single entry in the diff. If this flag is set to true, all files under ignored directories will be included in the diff, too. Examples: # Emulating `git diff <treeish>` tree = Rugged::Tree.lookup(repo, "d70d245ed97ed2aa596dd1af6536e4bfdb047b69") diff = tree.diff(repo.index) diff.merge!(tree.diff) # Tree-to-Tree Diff tree = Rugged::Tree.lookup(repo, "d70d245ed97ed2aa596dd1af6536e4bfdb047b69") other_tree = Rugged::Tree.lookup(repo, "7a9e0b02e63179929fed24f0a3e0f19168114d10") diff = tree.diff(other_tree)
Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/rugged-1.7.1/lib/rugged/tree.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Rugged--Tree-diff-for-pr
# Commit to gitgit add app/server/ruby/vendor/rugged-1.7.1/lib/rugged/tree.rbgit commit -m "better docs for Rugged::Tree.diff"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Rugged--Tree-diff-for-pr
hub pull-request
# Celebrate!