使用LibGit2Sharp,Status命令是否应显示已提交但尚未推送的更改?

时间:2017-08-15 19:19:23

标签: c# libgit2sharp

我有一个存储库,我目前有两个文件。我对一个文件进行了更改,并提交了更改,但尚未推送它。当我从命令行运行'git status'时,我得到以下内容:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean

这是预期的。

我在C#中有一些代码来获取存储库的状态,如下所示:

using (Repository repo = new Repository(localRepoFolder))
{
    RepositoryStatus status = repo.RetrieveStatus();
}

当我单步执行代码并转储 status 变量时,我得到以下内容:

status
+0 ~0 -0 | +0 ~0 -0 | i0
Added: Count = 0
DebuggerDisplay: "+0 ~0 -0 | +0 ~0 -0 | i0"
Ignored: Count = 0
IsDirty: false
Missing: Count = 0
Modified: Count = 0
Removed: Count = 0
RenamedInIndex: Count = 0
RenamedInWorkDir: Count = 0
Staged: Count = 0
Unaltered: Count = 0
Untracked: Count = 0
added: Count = 0
dispatcher: Count = 9
ignored: Count = 0
isDirty: false
missing: Count = 0
modified: Count = 0
removed: Count = 0
renamedInIndex: Count = 0
renamedInWorkDir: Count = 0
staged: Count = 0
statusEntries: Count = 0
unaltered: Count = 0
untracked: Count = 0
Results View: Expanding the Results View will enumerate the IEnumerable

它似乎没有像命令行那样显示本地和远程之间的区别。如何让它显示与命令行状态命令相同?

1 个答案:

答案 0 :(得分:1)

constructor(private _router:Router){} changePage(){ this._router.navigate(["dashboard"]); } 只提供存储库的实际状态 - Status与索引之间的差异,加上索引与工作目录之间的差异。它不包括任何其他元数据,如前/后计数。

如果您想知道您的分支与其跟踪分支的关系,那么您可以查看分支的HEAD。例如:

TrackingDetails