Error when applying patch that removes submodule
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 10.6k
- 派生
- 2.7k
- PR 合并指标
- 30 天内没有已合并 PR
描述
Reproduction steps
on any existing repo that contains a submodule generate a diff that removes it:
$ git rm <submodule name>
$ git diff --staged > remove-submodule.patch
(I used git 2.25.1)
my generated patch looks like this:
diff --git a/.gitmodules b/.gitmodules
index 1b59123..e69de29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "submodule"]
- path = submodule
- url = ../submodule
diff --git a/submodule b/submodule
deleted file mode 160000
index xxxxx..0000000
--- a/fus-modules
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit xxxxxxxxxxxxxxxxxxxxxxxxxxx
And when running this small program that uses libgit2:
test.c.txt
built using
gcc test.c -lgit2 -L <path to libgit2>/libgit2/build/ -Wall -pedantic -I <path to libgit2>/libgit2/include/
And run like this:
LD_LIBRARY_PATH=<path to libgit2>/libgit2/build/ ./a.out <Path to repo> <path to patch file>
Expected behavior
It successfully applies the change
Actual behavior
Error applying patch: -1 no error
I checked also modifying the submodule and it fails too
Version of libgit2 (release number or SHA1)
1.3.0 and main ( d74d491481831ddcd23575d376e56d2197e95910 )
Operating system(s) tested
Linux (Ubuntu 20.04)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从附带的 test.c.txt 程序开始,使用删除或修改子模块的 patch 重现该故障。跟踪针对所报告的“-1 no error”结果的 patch 应用路径,然后验证提供的删除 patch 能在 Linux 上成功应用。该 issue 没有指出源文件或回归测试,因此定位相关实现和测试覆盖情况需要对 repository 进行研究。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, git
- 领域
- devtools, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100