File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ def is_thor_reserved_word?(word, type)
3333 type : :boolean ,
3434 desc : 'Analyze changes in git staging area'
3535
36+ method_option :workdir ,
37+ type : :boolean ,
38+ aliases : [ '-w' ] ,
39+ desc : 'Analyze both staged and unstaged changes'
40+
3641 method_option :runner ,
3742 type : :array ,
3843 default : [ ] ,
@@ -55,7 +60,7 @@ def run(path = '.')
5560
5661 formatters = ::Pronto ::Formatter . get ( options [ :formatters ] )
5762
58- commit_options = %i[ staged unstaged index ]
63+ commit_options = %i[ workdir staged unstaged index ]
5964 commit = commit_options . find { |o | options [ o ] } || options [ :commit ]
6065
6166 repo_workdir = ::Rugged ::Repository . discover ( path ) . workdir
Original file line number Diff line number Diff line change @@ -13,6 +13,18 @@ def diff(commit, options = nil)
1313 [ head_commit_sha , @repo . index . diff ( options ) ]
1414 when :staged
1515 [ head_commit_sha , head . diff ( @repo . index , options ) ]
16+ when :workdir
17+ [
18+ head_commit_sha ,
19+ @repo . diff_workdir (
20+ head ,
21+ {
22+ include_untracked : true ,
23+ include_untracked_content : true ,
24+ recurse_untracked_dirs : true
25+ } . merge ( options || { } )
26+ )
27+ ]
1628 else
1729 merge_base = merge_base ( commit )
1830 patches = @repo . diff ( merge_base , head , options )
Original file line number Diff line number Diff line change @@ -92,6 +92,15 @@ module Git
9292 let ( :sha ) { :staged }
9393 it { should be_one }
9494 end
95+
96+ context 'workdir' do
97+ let ( :sha ) { :workdir }
98+
99+ it do
100+ # this count includes all the files from the repositories (*.git)
101+ subject . count . should eq 48
102+ end
103+ end
95104 end
96105
97106 describe '#blame' do
You can’t perform that action at this time.
0 commit comments