我正在尝试使用 C# 库 LibGit2Sharp 在另一个程序打开时添加和提交二进制文件。调用失败并出现Repository.Index.RetrieveStatus()
异常:
为散列读取文件时出错:该进程无法访问该文件,因为另一个进程已锁定该文件的一部分。
但是,从 shell 调用的 git 二进制文件执行相同的操作没有问题:
$ 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
有没有办法说服 LibGit2Sharp 表现得像记录的那样?