【发布时间】:2014-06-14 02:52:47
【问题描述】:
我正在尝试使用 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 表现得像 documented?
【问题讨论】:
标签: c# libgit2sharp filelock