@@ -129,32 +129,70 @@ IEnumerator IEnumerable.GetEnumerator()
129
129
130
130
/// <summary>
131
131
/// 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.
132
134
/// </summary>
133
135
/// <param name="path">The path of the file within the working directory.</param>
134
136
/// <param name="explicitPathsOptions">
135
137
/// If set, the passed <paramref name="path"/> will be treated as explicit paths.
136
138
/// Use these options to determine how unmatched explicit paths should be handled.
137
139
/// </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 )
139
154
{
140
155
Ensure . ArgumentNotNull ( path , "path" ) ;
141
156
142
- Stage ( new [ ] { path } , explicitPathsOptions ) ;
157
+ Stage ( new [ ] { path } , stageOptions ) ;
143
158
}
144
159
145
160
/// <summary>
146
161
/// 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.
147
164
/// </summary>
148
165
/// <param name="paths">The collection of paths of the files within the working directory.</param>
149
166
/// <param name="explicitPathsOptions">
150
167
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
151
168
/// Use these options to determine how unmatched explicit paths should be handled.
152
169
/// </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 )
154
184
{
155
185
Ensure . ArgumentNotNull ( paths , "paths" ) ;
156
186
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 ) ;
158
196
159
197
foreach ( var treeEntryChanges in changes )
160
198
{
0 commit comments