Class: Shiba::Review::Diff::GitDiff
- Inherits:
-
Object
- Object
- Shiba::Review::Diff::GitDiff
- Defined in:
- lib/shiba/review/diff.rb
Instance Method Summary collapse
-
#file(context: nil, ignore_deletions: false) ⇒ Object
Differ expects context: 0, ignore_deletions: true.
-
#initialize(options) ⇒ GitDiff
constructor
Valid options are: “staged”, “unstaged”, “branch”, and “verbose”.
- #paths ⇒ Object
Constructor Details
#initialize(options) ⇒ GitDiff
Valid options are: “staged”, “unstaged”, “branch”, and “verbose”
135 136 137 |
# File 'lib/shiba/review/diff.rb', line 135 def initialize() @options = end |
Instance Method Details
#file(context: nil, ignore_deletions: false) ⇒ Object
Differ expects context: 0, ignore_deletions: true
159 160 161 162 163 164 |
# File 'lib/shiba/review/diff.rb', line 159 def file(context: nil, ignore_deletions: false) differ = "git diff#{cmd}" differ << " --unified=#{context}" if context differ << " --diff-filter=d" if ignore_deletions run(differ) end |
#paths ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/shiba/review/diff.rb', line 139 def paths if ['verbose'] puts cmd end run = "git diff#{cmd} --name-only --diff-filter=d" if [:verbose] $stderr.puts run end result = `#{run}` if $?.exitstatus != 0 $stderr.puts result raise Shiba::Error.new "Failed to read changes" end result.split("\n") end |