How can I rename a directory in libgit2sharp (under Windows, which is case insensitive) when it's just a case change?
This code works fine for moving files across different directories:
File.Move(@"C:\repo\folder1\file.txt", @"C:\repo\folder2\file.txt");
repo.Index.Remove("folder1/file.txt");
repo.Index.Add("folder2/file.txt");
repo.Index.Write();
var commitResult = repo.Commit(logMessage, author, author);
However, if I'm just renaming case of a folder, it doesn't work:
Directory.Move(@"C:\repo\folder1\", @"C:\repo\Folder1\");
repo.Index.Remove("folder1/file.txt");
repo.Index.Add("Folder1/file.txt");
repo.Index.Write();
var commitResult = repo.Commit(logMessage, author, author); // nothing gets written - I get LibGit2Sharp.EmptyCommitException
I also tried doing 2 renames (and commiting once at the end) like suggested by this answer
Am I doing something wrong or this is a git limitation? Is there any workaround besides doing an intermediate commit?
PS: I tried changing the repo to ignorecase=false (the default in Windows is true), but it didn't work either.