@@ -121,6 +121,12 @@ def self.cloned_to(clone_output)
121121 # @example worktree = Worktree.open(worktree_path) worktree.status #=>
122122 # #<RubyGit::Status::Report ...>
123123 #
124+ # @param path_specs [Array<String>] paths to limit the status to
125+ # (default is all paths)
126+ #
127+ # See [git-glossary
128+ # pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec).
129+ #
124130 # @param untracked_files [:all, :normal, :no] Defines how untracked files will be
125131 # handled
126132 #
@@ -140,11 +146,15 @@ def self.cloned_to(clone_output)
140146 #
141147 # @return [RubyGit::Status::Report] the status of the working tree
142148 #
143- def status ( untracked_files : :all , ignored : :no , ignore_submodules : :all )
149+ def status ( * path_specs , untracked_files : :all , ignored : :no , ignore_submodules : :all ) # rubocop:disable Metrics/MethodLength
144150 command = %w[ status --porcelain=v2 --branch --show-stash --ahead-behind --renames -z ]
145151 command << "--untracked-files=#{ untracked_files } "
146152 command << "--ignored=#{ ignored } "
147153 command << "--ignore-submodules=#{ ignore_submodules } "
154+ unless path_specs . empty?
155+ command << '--'
156+ command . concat ( path_specs )
157+ end
148158 options = { out : StringIO . new , err : StringIO . new }
149159 status_output = run ( *command , **options ) . stdout
150160 RubyGit ::Status . parse ( status_output )
0 commit comments