I'm trying to use the C# library LibGit2Sharp to add and commit a binary file while it is open by another program. The Repository.Index.RetrieveStatus()
call fails with an exception:
Error reading file for hashing: The process cannot access the file because another process has locked a portion of the file.
However the git binary invoked from shell has no problem performing the same action:
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: files/foo.bin
no changes added to commit (use "git add" and/or "git commit -a")
$ git add files/foo.bin
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: files/foo.bin
Is there a way to convince LibGit2Sharp to behave as documented?