Following block works when I stage at least one tracked file. But when I stage only untracked files, repo.RetrieveStatus().Staged.Count equals to zero (I expect it to be incremented by the number of files staged), thus doesn't satisfy if condition and don't commit.
using (var repo = new LibGit2Sharp.Repository(RepoPath))
{
Commands.Stage("*");
Signature author = new Signature(username, email, DateTime.Now);
Signature committer = author;
if (repo.RetrieveStatus().Staged.Any())
{
Commit commit = repo.Commit(CommitMessage, author, committer);
Console.WriteLine(commit.ToString());
}
}
Is this a bug, or I am misusing it?