libgit2 / libgit2/libgit2sharp

Checkout with modified but not dirty submodules

未关闭
#1,150 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
3.5k
派生
925
PR 合并指标
30 天内没有已合并 PR

描述

Version : vNext & master
Native : 1.0.72 - git2-4d6362b

There are two types of modified submodules, one that shows as modified due to a index pointer(SHA) mismatch, and one due to the submodule's content actually being changed/modified. Git knows the different and does not require a 'checkout -force'. or a 'git submodule update' on each submodule before doing a checkout, but libgit2sharp/libgit2 does require the checkout to be forced.

Is this the intended/designed result with modified/index and modified/dirty submodules? Or a bug?

It is a thrown exception from libgit2, so I coded around it with a exception bound helper extension to determine if the errors are related to submodules and to go determine if just the index changed and thus it is safe to flip the force option on or if the submodules are dirty and what are the 'real' exceptions within each submodule and throw those. It just seems like this should be one in one the libraries like it is within git (IMHO)...

This will not be a forced git checkout:

diff --git a/external/cecil b/external/cecil
index 33d50b8..fc76b93 160000
--- a/external/cecil
+++ b/external/cecil
@@ -1 +1 @@
-Subproject commit 33d50b874fd527118bc361d83de3d494e8bb55e1
+Subproject commit fc76b93e3e0064b2d751796878f9cbe88df1d5f4

This would be a forced git checkout:

diff --git a/external/rx b/external/rx
index b29a4b0..17e8477 160000
--- a/external/rx
+++ b/external/rx
@@ -1 +1 @@
-Subproject commit b29a4b0fda609e0af33ff54ed13652b6ccf0e05e
-Subproject commit b29a4b0fda609e0af33ff54ed13652b6ccf0e05e-dirty

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试。首先使用一个 index pointer 不同的 submodule 和一个内容 dirty 的 submodule 重现 checkout 行为,然后跟踪 libgit2sharp 的 checkout 错误处理。完成标准是,仅 pointer 的变更不需要 force,同时 dirty submodule 仍受到保护,并且其底层错误得到保留。

由索引模型根据 Issue 内容生成。

评估

技术栈
csharp, git
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。