@@ -129,32 +129,70 @@ IEnumerator IEnumerable.GetEnumerator()
129129
130130 /// <summary>
131131 /// Promotes to the staging area the latest modifications of a file in the working directory (addition, updation or removal).
132+ ///
133+ /// If this path is ignored by configuration then it will not be staged.
132134 /// </summary>
133135 /// <param name="path">The path of the file within the working directory.</param>
134136 /// <param name="explicitPathsOptions">
135137 /// If set, the passed <paramref name="path"/> will be treated as explicit paths.
136138 /// Use these options to determine how unmatched explicit paths should be handled.
137139 /// </param>
138- public virtual void Stage ( string path , ExplicitPathsOptions explicitPathsOptions = null )
140+ [ Obsolete ( "This will be removed in a future release. Supply ExplicitPathsOptions to StageOptions." ) ]
141+ public virtual void Stage ( string path , ExplicitPathsOptions explicitPathsOptions )
142+ {
143+ Stage ( path , new StageOptions { ExplicitPathsOptions = explicitPathsOptions } ) ;
144+ }
145+
146+ /// <summary>
147+ /// Promotes to the staging area the latest modifications of a file in the working directory (addition, updation or removal).
148+ ///
149+ /// If this path is ignored by configuration then it will not be staged unless <see cref="StageOptions.IncludeIgnored"/> is unset.
150+ /// </summary>
151+ /// <param name="path">The path of the file within the working directory.</param>
152+ /// <param name="stageOptions">If set, determines how paths will be staged.</param>
153+ public virtual void Stage ( string path , StageOptions stageOptions = null )
139154 {
140155 Ensure . ArgumentNotNull ( path , "path" ) ;
141156
142- Stage ( new [ ] { path } , explicitPathsOptions ) ;
157+ Stage ( new [ ] { path } , stageOptions ) ;
143158 }
144159
145160 /// <summary>
146161 /// Promotes to the staging area the latest modifications of a collection of files in the working directory (addition, updation or removal).
162+ ///
163+ /// Any paths (even those listed explicitly) that are ignored by configuration will not be staged.
147164 /// </summary>
148165 /// <param name="paths">The collection of paths of the files within the working directory.</param>
149166 /// <param name="explicitPathsOptions">
150167 /// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
151168 /// Use these options to determine how unmatched explicit paths should be handled.
152169 /// </param>
153- public virtual void Stage ( IEnumerable < string > paths , ExplicitPathsOptions explicitPathsOptions = null )
170+ [ Obsolete ( "This will be removed in a future release. Supply ExplicitPathsOptions to StageOptions." ) ]
171+ public virtual void Stage ( IEnumerable < string > paths , ExplicitPathsOptions explicitPathsOptions )
172+ {
173+ Stage ( paths , new StageOptions { ExplicitPathsOptions = explicitPathsOptions } ) ;
174+ }
175+
176+ /// <summary>
177+ /// Promotes to the staging area the latest modifications of a collection of files in the working directory (addition, updation or removal).
178+ ///
179+ /// Any paths (even those listed explicitly) that are ignored by configuration will not be staged unless <see cref="StageOptions.IncludeIgnored"/> is unset.
180+ /// </summary>
181+ /// <param name="paths">The collection of paths of the files within the working directory.</param>
182+ /// <param name="stageOptions">If set, determines how paths will be staged.</param>
183+ public virtual void Stage ( IEnumerable < string > paths , StageOptions stageOptions = null )
154184 {
155185 Ensure . ArgumentNotNull ( paths , "paths" ) ;
156186
157- var changes = repo . Diff . Compare < TreeChanges > ( DiffModifiers . IncludeUntracked | DiffModifiers . IncludeIgnored , paths , explicitPathsOptions ) ;
187+ DiffModifiers diffModifiers = DiffModifiers . IncludeUntracked ;
188+ ExplicitPathsOptions explicitPathsOptions = stageOptions != null ? stageOptions . ExplicitPathsOptions : null ;
189+
190+ if ( stageOptions != null && stageOptions . IncludeIgnored )
191+ {
192+ diffModifiers |= DiffModifiers . IncludeIgnored ;
193+ }
194+
195+ var changes = repo . Diff . Compare < TreeChanges > ( diffModifiers , paths , explicitPathsOptions ) ;
158196
159197 foreach ( var treeEntryChanges in changes )
160198 {
0 commit comments