8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fdb4bd commit 90dc807Copy full SHA for 90dc807
LibGit2Sharp/Index.cs
@@ -211,7 +211,24 @@ public virtual void Unstage(string path)
211
/// <param name = "paths">The collection of paths of the files within the working directory.</param>
212
public virtual void Unstage(IEnumerable<string> paths)
213
{
214
- repo.Reset("HEAD", paths);
+ Commit commit = repo.Lookup("HEAD",
215
+ GitObjectType.Any,
216
+ LookUpOptions.DereferenceResultToCommit) as Commit;
217
+
218
+ if (null != commit)
219
+ {
220
+ repo.Reset("HEAD", paths);
221
+ }
222
+ else
223
224
+ // HEAD doesn't exist, so all these staged paths must be Added.
225
+ foreach (String path in paths)
226
227
+ RemoveFromIndex(path);
228
229
230
+ UpdatePhysicalIndex();
231
232
}
233
234
/// <summary>
0 commit comments